gpt4 book ai didi

java - Websocket 一段时间后(20-30 分钟)停止接收数据

转载 作者:太空宇宙 更新时间:2023-11-04 12:56:37 26 4
gpt4 key购买 nike


我在java中有websocket,它每秒向javascript websocket客户端发送几条消息(5 -10),然后使用角度ui网格进行显示。

问题是20-30分钟后,浏览器(IE、Firefox、chrome)停止接收消息。

  • 可能是什么问题?
  • javax.websocket.Session 的默认 session 超时值是多少?
  • 我应该检查哪些设置/值,例如getMaxTextMessageBufferSize()

最佳答案

检查 getMaxIdleTimeout()/setMaxIdleTimeout() 是否是您要找的。

来自 setMaxIdleTimeout() 的 javax.websocket.Session 文档:

Set the non-zero number of milliseconds before this session will be closed by the container if it is inactive, ie no messages are either sent or received. A value that is 0 or negative indicates the session will never timeout due to inactivity.

关于java - Websocket 一段时间后(20-30 分钟)停止接收数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35340721/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com