Skip to content

Instantly share code, notes, and snippets.

@matthijskooijman
Last active August 29, 2015 13:59
Show Gist options
  • Save matthijskooijman/10489774 to your computer and use it in GitHub Desktop.
Save matthijskooijman/10489774 to your computer and use it in GitHub Desktop.
Sending "fooxbar"
Now:
MESH: "foox"
HQ: {"type":"reply","id":%d,"from":%d,"reply":"foox"}
MESH: "bar\0"
HQ: {"type":"reply","id":%d,"from":%d,"reply":"bar", end: true}
New:
MESH: {"type":"reply","id":%d,"from":%d,"reply":"foox"}
HQ: {"type":"reply","id":%d,"from":%d,"reply":"foox"}
MESH: {"type":"reply","id":%d,"from":%d,"reply":"bar", end: true}
HQ: {"type":"reply","id":%d,"from":%d,"reply":"bar", end: true}
// downside: large mesh overhead
Alternative:
MESH: {"type":"reply","id":%d,"from":%d,"reply":"foox
HQ: {"type":"reply","id":%d,"from":%d,"reply":"foox
MESH: bar", end: true}
HQ: bar", end: true}
// This doesn't have the overhead, but blocks the HQ connection
// Also, this effectively changes the HQ protocol, it now sends the
// reply in a single packet instead of two
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment