最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Websockets and binary data - Stack Overflow

programmeradmin3浏览0评论

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?

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?

Share Improve this question edited Jul 29, 2011 at 7:42 Dmitrii Sorin asked Jul 29, 2011 at 7:30 Dmitrii SorinDmitrii Sorin 4,0264 gold badges33 silver badges40 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

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 parison of WebSockets implementations (browsers, client, servers) that has a feature row for "binary messages":

http://en.wikipedia/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 parison, see:

http://autobahn.ws/testsuite/

发布评论

评论列表(0)

  1. 暂无评论