java websocket 上传大文件,java - Websocket上的Spring Stomp:流式传输大文件 - 堆栈内存溢出...

我的SockJs客户端在网页中发送的消息的帧大小为16K。 邮件大小限制决定了我可以传输的文件的最大大小。

以下是我在文档中找到的内容。

/**

* Configure the maximum size for an incoming sub-protocol message.

* For example a STOMP message may be received as multiple WebSocket messages

* or multiple HTTP POST requests when SockJS fallback options are in use.

*

*

In theory a WebSocket message can be almost unlimited in size.

* In practice WebSocket servers impose limits on incoming message size.

* STOMP clients for example tend to split large messages around 16K

* boundaries. Therefore a server must be able to buffer partial content

* and decode when enough data is received. Use this property to configure

* the max size of the buffer to use.

*

*

The default value is 64K (i.e. 64 * 1024).

*

*

NOTE that the current version 1.2 of the STOMP spec

* does not specifically discuss how to send STOMP messages over WebSocket.

* Version 2 of the spec will but in the mean time existing client libraries

* have already established a practice that servers must handle.

*/

public WebSocketTransportRegistration setMessageSizeLimit(int messageSizeLimit) {

this.messageSizeLimit = messageSizeLimit;

return this;

}

我的问题:我可以设置部分消息传递,以便文件被部分传输,而不像现在那样作为单个消息传输吗?

更新:仍在寻找使用部分消息传递的解决方案同时,现在对大型消息(在我的应用程序中是文件上传/下载)使用HTTP。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值