$30 off During Our Annual Pro Sale. View Details »

KRTConf: WebSockets & Sub-Protocols

November 11, 2011

KRTConf: WebSockets & Sub-Protocols


November 11, 2011

More Decks by miksago

Other Decks in Programming


  1. Micheil Smith - @miksago WebSockets & Sub-protocols


  3. ...and we think that WebSockets are awesome, but...

  4. ...they are too low level for most applications

  5. ...until we add extra meaning to them

  6. What are Sub-Protocols? • A definition of the data over

    a WebSocket Connection. • A way to negotiate communication between Client and Server. • A way to standardise what we’re already doing with WebSockets today.
  7. Common ways to use WebSockets • Events • Channels •

    Request / Response • Firehoses • Query / Filter Streams
  8. Events • Streams of data augmented with an “event-type”. •

    A form of Publish / Subscribe paradigm • Usually paired with Channels
  9. Channels • Groups data into named buckets • Usually combined

    with “Events” • Most common way to use WebSockets • Examples: Pusher, Socket.io
  10. Request / Response • Both Synchronous and Asynchronous • JSON-RPC

    over WS (1.0, 2.0) • SOAP over WS (Microsoft, Jan 2012) • REST over WS
  11. Firehoses • A stream of data, where each message is

    a single piece of information • Structure of data is dependent on source • Could be as simple as the Twitter firehose over WebSockets
  12. Query / Filter Streams • Used on Firehoses of data

    • Client registers query with server • As data matches a query, it is sent to the client • Example: PubSub.io
  13. None
  14. Using Sub-Protocols • Defined in WSP Section 1.9 • Uses

    header in handshake for negotiation of sub-protocol. • Clients tell server which sub-protocols it supports, server then selects one to use. • Sub-protocols can be registered with IANA (WSP Section 11.5)
  15. Only registered one is... • SOAP over WS... by Microsoft

    (they haven’t actually defined the protocol yet)
  16. Lets start defining the first generation of sub-protocols!

  17. A few sub-protocols we should define • JSON-RPC • Standardised

    Channels & Events • Query streams • Publish / Subscribe
  18. We’re Hiring! Systems Engineer - Ruby, C, Haskell, Erlang, etc

    Head of Operations - Puppet/Chef, Cloud Architecture, etc Mobile Developer - low level Objective-C, Java
  19. Thanks for listening! @miksago on Twitter / Github / Geekli.st