Websockets和二进制数据 [英] Websockets and binary data
问题描述
那么,有没有支持二进制数据传输的websocket服务器? Socket.io似乎错过了这个机会。也许还有其他的一些功能?
支持WebSocket服务器中的二进制数据非常简单(实际上UTF-8的工作量较少)。真正的问题是在浏览器中支持二进制数据类型。它正在开发中,但截至目前还没有支持发送和接收二进制类型的浏览器发布(类型化数组,blob)。
如果您需要发送二进制数据现在在浏览器添加支持之前,您可以尝试我的 websockify python服务器和Javascript客户端库。它使用base64编码通过线路传输二进制数据。
某些链接:
$ b(而不是类型化数组/ blob)使用数字(0-255)数组来表示二进制数据。$ b
- Mozilla错误#666349
- WebKit bug#65249 (有关二进制数据支持的部分现在都已修复)
- W3C WebSockets API
- IETF HyBi WebSockets协议v10
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:
- Mozilla bug #666349
- WebKit bug #65249 (parts about binary data support are all fixed now)
- W3C WebSockets API
- IETF HyBi WebSockets protocol v10
这篇关于Websockets和二进制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!