Skip to content

Instantly share code, notes, and snippets.

@yifan-gu
Created December 24, 2013 23:02
Show Gist options
  • Save yifan-gu/8118625 to your computer and use it in GitHub Desktop.
Save yifan-gu/8118625 to your computer and use it in GitHub Desktop.
simple flow
message {
msgType (func name)
param
result
}
client:
select {
case <-send(encode(message))
return result or err_handle
case <-timetout
err_handle
}
server:
message = decode(recv())
switch (message.msgType) {
message.result=call_func(massage.param)
select {
case <-send(encode(message))
success or err_handle
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment