Websockets And Binary Data
Solution 1:
Supporting binary data in WebSocket servers is pretty trivial (less work that UTF-8 actually). The real problem is supporting binary data types in the browser. It is being worked on, but as of yet there are no browser releases that can support sending and receiving binary types (typed arrays, blobs).
If you need to send binary data now before browsers add support, you can try my websockify python server and Javascript client library. It uses base64 encoding to transfer binary data over the wire. Instead of typed arrays/blobs, it uses arrays of numbers (0-255) to represent binary data on the Javascript side.
Some links:
- Mozilla bug #666349
- WebKit bug #65249 (parts about binary data support are all fixed now)
- W3C WebSockets API
- IETF HyBi WebSockets protocol v10
Solution 2:
Here is a comparison of WebSockets implementations (browsers, client, servers) that has a feature row for "binary messages":
http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations
Currently (09/16/2011), the browsers supporting binary WS messages are:
- Chrome 15 or higher
- IE10 (part of Windows 8 developer preview)
- Firefox 11 or higher
For detailed test reports and browser comparison, see:
Post a Comment for "Websockets And Binary Data"