SockJS消息的最大大小是多少?

时间:2022-06-11 18:03:41

I'm using Vert.x and SockJS to transfer data encapsulated in messages. Is there a specification how big the SockJS/Websocket messages can be?

我正在使用Vert.x和SockJS来传输封装在消息中的数据。是否有规范SockJS / Websocket消息有多大?

1 个解决方案

#1


7  

There isn't an explicit limit of a size of a SockJS message. But unfortunately SockJS is quite fragile and should not be used to send huge data. In ideal world you'd send control messages (latency-sensitive) over SockJS and big payloads (for throughput) using external methods - for example using an AJAX call.

没有明确的SockJS消息大小限制。但不幸的是,SockJS非常脆弱,不应该用来发送大量数据。在理想的世界中,您将使用外部方法(例如使用AJAX调用)向SockJS和大型有效负载(用于吞吐量)发送控制消息(延迟敏感)。

On technical side you should be able to push pretty much anything over websockets transport, but on streaming and polling ones you need to be more careful. Specifically, a polling requests must be reestablished within 5 seconds, and it may be tough when all the bandwidth is occupied by sending data from the browser to the server. So, uploading large blobs is not recommended with sockjs.

在技​​术方面,你应该能够在websockets传输上推送几乎任何东西,但是在流媒体和轮询方面,你需要更加小心。具体而言,必须在5秒内重新建立轮询请求,并且通过从浏览器向服务器发送数据来占用所有带宽可能很困难。因此,不建议使用sockjs上传大blob。

#1


7  

There isn't an explicit limit of a size of a SockJS message. But unfortunately SockJS is quite fragile and should not be used to send huge data. In ideal world you'd send control messages (latency-sensitive) over SockJS and big payloads (for throughput) using external methods - for example using an AJAX call.

没有明确的SockJS消息大小限制。但不幸的是,SockJS非常脆弱,不应该用来发送大量数据。在理想的世界中,您将使用外部方法(例如使用AJAX调用)向SockJS和大型有效负载(用于吞吐量)发送控制消息(延迟敏感)。

On technical side you should be able to push pretty much anything over websockets transport, but on streaming and polling ones you need to be more careful. Specifically, a polling requests must be reestablished within 5 seconds, and it may be tough when all the bandwidth is occupied by sending data from the browser to the server. So, uploading large blobs is not recommended with sockjs.

在技​​术方面,你应该能够在websockets传输上推送几乎任何东西,但是在流媒体和轮询方面,你需要更加小心。具体而言,必须在5秒内重新建立轮询请求,并且通过从浏览器向服务器发送数据来占用所有带宽可能很困难。因此,不建议使用sockjs上传大blob。