Create a gist now

Instantly share code, notes, and snippets.

@val314159 /ypsp.md
Last active Sep 30, 2015

What would you like to do?
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