Real-Time with Flowdock

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
lautis
March 28, 2012

Real-Time with Flowdock

lautis

March 28, 2012

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

76 slides
  1. Server-Sent Events HTTP/1.1 200 OK Content-Type: text/event-stream data: {'content': 'json'}

    id: 2 data: {'content': 'json'} Sent to server on reconnect Thursday, March 15, 12
  2. In JavaScript var es = new EventSource('/events'); es.onmessage = function

    (e) { console.log(JSON.parse(e.data)); }; Thursday, March 15, 12
  3. WebSockets var socket = new WebSocket('/socket'); socket.onmessage = function (e)

    { console.log(JSON.parse(e.data)); }; Thursday, March 15, 12
  4. WebSockets var socket = new WebSocket('/socket'); socket.onmessage = function (e)

    { console.log(JSON.parse(e.data)); }; socket.onopen = function() { var m = {'content': 'json'}; socket.send(JSON.stringify(m)); } Thursday, March 15, 12
  5. Caveats •Limited browser support •Proxy problems •Safari crashes when used

    with Proxy Auto-Configuration Thursday, March 15, 12
  6. 1.Post new stuff 2.Receive new stuff 3.Modify existing stuff Basic

    operations in Flowdock Thursday, March 15, 12
  7. •Clients process messages as much as possible •Server adds unique

    ID and timestamp to data Posting messages Thursday, March 15, 12
  8. •Clients process messages as much as possible •Server adds unique

    ID and timestamp to data •Message echoed to client Posting messages Thursday, March 15, 12
  9. "Operation, which can be applied multiple times without changing the

    result beyond the initial application." Idempotent changes Thursday, March 15, 12
  10. Protips •Socket.IO will bite you •SSE is safe choice for

    streaming •Design for broken internet Thursday, March 15, 12

More Decks by lautis

Other Decks in Programming