Websockets and binary data


As far as i know websockets support binary data transfer. Binary support bug is fixed.

So, are there any websocket servers which support binary data transfer? Socket.io seems to miss this opportunity. Maybe there are some others?

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:


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:

http://autobahn.ws/testsuite/