Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KRTConf: WebSockets & Sub-Protocols

miksago
November 11, 2011

KRTConf: WebSockets & Sub-Protocols

miksago

November 11, 2011
Tweet

More Decks by miksago

Other Decks in Programming

Transcript

  1. 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.
  2. Common ways to use WebSockets • Events • Channels •

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

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

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

    over WS (1.0, 2.0) • SOAP over WS (Microsoft, Jan 2012) • REST over WS
  6. 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
  7. 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
  8. 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)
  9. Only registered one is... • SOAP over WS... by Microsoft

    (they haven’t actually defined the protocol yet)
  10. A few sub-protocols we should define • JSON-RPC • Standardised

    Channels & Events • Query streams • Publish / Subscribe
  11. 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