开发者

Websockets and binary data

开发者 https://www.devze.com 2023-03-23 22:34 出处:网络
As far as i know websockets support binary data transfer. Binary support bug is fixed. So, are there any websocket servers which s开发者_C百科upport binary data transfer? Socket.io seems to miss this

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

So, are there any websocket servers which s开发者_C百科upport 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:

  • Mozilla bug #666349
  • WebKit bug #65249 (parts about binary data support are all fixed now)
  • W3C WebSockets API
  • IETF HyBi WebSockets protocol v10


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号