4

Currently, im sending base64 strings over my socket.io 0.9 to send images around in my chat app.

I upgraded to socket.io 1.0, which in the documentation says it supports Binary data, like Buffers. I have little knowledge over what Buffers are, but can seem to get it work.

What is the advantage for me, would i move all my base64 string into Buffers and sending them, instead of the raw string. Does the Binary support do anything smart for large messages?

4

1 回答 1

2

socket.io 引入了发送二进制数据的能力主要是因为用户要求它。

如果直接将图像作为缓冲区发送,则会减少带宽。Base64 比原始数据大小大约大 37%。

来源:base64 编码的图像大小

于 2014-07-13T18:03:33.423 回答