Tuesday, March 8, 2011

[BoulderJug] Title: Introduction to Web Sockets by: Jonny Way : Time Warner Cable

What are web Sockets ?

Part of Html5 : Forms, GeoLocation, File API etc

There is no websocket tag. its a Bi Directional full duplex TCP socket communication. It has its own protocol Its ascii only, binary is in works. Supports TLS. Like most HTML5 tech, this is in works

  • supports real time communication needs like games, chat servers etc.
  • cuts down on http overhead (headers, cookies, 302s)
  • with web sockets its just 2 byte overhead
  • can replace Flash sockeys. XHR long pools, forever frames etc

Var webSocket = new WebSocket(“ws://aaa.bb.com”); webSocket.onMessage webSocket.onClose webSocket.send

problems: - no support in legacy browsers - inconsisent support in browsers that claim support - security concerns is causing ff4 to deprecate suppoer

workaround - comet (XHR long poll) - scalability issues - on client : uses up one of two allowed connection - on server : manage multiple connections - JSONP - bit for a hack - same origin policy does not apply to the dynamically supported ags - forever frame : - invisible frame - mix presentation & functionality etc - flash xmlsockets - not available on mobile platform (iOS) - plugin, debugging etc

solution - socket io : abstracts socket method into unified api (socket.io) - includes server code - open source - jWebSocket - servlet like api - open source - cometD - Dojo driven - Jetty & Glassfish implement it - Pusherapp - SAAS - Atmosphere - comtainer agnostic done by glassfish guy

Scaling challenges - connections have state - communication pipeline to app server - LB needs introspection

Controvery - HTTP upgrade vs CONNECT (verb) : some proxy server dont implement http upgrade correctly, thus some browsers are choosing to use connect for negotiating the protocol (purist dont like this, its abuse of the connet verb)

links - websocket.org - socket.io

No comments:

Post a Comment