Skip to content

Instantly share code, notes, and snippets.

@val314159
Last active September 30, 2015 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save val314159/175869ef985012b1d966 to your computer and use it in GitHub Desktop.
Save val314159/175869ef985012b1d966 to your computer and use it in GitHub Desktop.
yottapubsub.md

ypsp v1.0 - yotta pub-sub protocol

This protocol sits on top of something like a websocket or similar transport layer.

Example

  • Server says hello, also tells you your sessionid

[0,":HELLO:",{sessionId:"<sessionid>"}]

  • Client subscribes to a bunch of channels (not including "sessionid" or "*")

[0,":SUB:",{channels:["x","y","z"]}]

  • Client publishes a value over a channel

[1,"*","ridXYZ",["Hello"]]

  • Server publishes a wrapped message to the "*" channel

[2,"<sessionid>",[1,"*","ridXYZ",["Hello"]]]

  • Other Client decides to say hello back

[1,"<originalsessionid>","",["ShakeHands"],{replyId:"ridXYZ"}]]

  • Original client hears the hello back

[2,"<remotesessionid>",[1,"<originalsessionid>","",["ShakeHands"],{replyId:"ridXYZ"}]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment