Wednesday, July 24, 2013

OSCON Server-Side Push: Comet, Web Sockets, and Server-Sent Events

The Server-Side Push: Comet, Web Sockets, and Server-Sent Events on the OSCON site.

Brian Sam-Bodden (Integrallis Software, LLC.)
2:30pm Wednesday, 07/24/2013

Polling - classic "are we there yet?" to allow the server to communicate updates. Self-DDoS attack

iFrame Streaming -
- embed an invisible iFrame (using jQuery)
- server returns chunks of data in a loop
- bind iFrame JS to parent page JS

XHR Streaming
- XMLHTTP request
- uses an AJAX call in background and sends JSON
- complexity now on client. need to watch the stream and determine the delta

Long polling
- most commonly used
- still used as a fallback
- blocks on server until something available then returns
- reestablish the request after server timeout
- thread of execution is blocked on the server

Flash streaming
- XML Socket
- creates a 1 pixel movie in page and uses a streaming movie's socket

Above are the less optimal

Push Frameworks

- previously associated with long polling
- now frameworks will interrogate the browser and pick the most appropriate technique
- provide both client and server side components
- many use a pub-sub protocol
- protocol is Bayeaux
(faye is good for ruby)

Web Sockets
- Two way communications (tcp/ip socket)
- dedicated socket
- works with security, firewalls and proxies

Server-sent events
- from server to client
- unidirectional
- typically use UDP


Use a framework, allows graceful degradation

No comments:

Post a Comment