The basics of a WebSockets server in Ruby EventMachine and your own custom JSON protocol for Events-centric WebSockets programming.
See more at http://blog.new-bamboo.co.uk/2010/2/10/json-event-based-convention-websockets
20. WebSockets & Ruby EventMachine
blog.new-bamboo.co.uk
Ismael Celis new bamboo
Editor's Notes
- WebSockets is a HTML5 standard for server-browser persistent connections
- Bidirectional
- Less overhead than polling and long-polling
- callbacks
- Browser sends “Upgrade” request.
- Server “upgrades” connection to persistent TCP socket.
- No more headers sent.
- “messages” delimited by these hex characters (null and termination)
- incoming message triggers “onmessage”.
- “send” method wraps messages internally