我在java中有websocket,它每秒向javascript websocket客户端发送几条消息(5 -10),然后使用角度ui网格进行显示。
问题是20-30分钟后,浏览器(IE、Firefox、chrome)停止接收消息。
- 可能是什么问题?
- javax.websocket.Session 的默认 session 超时值是多少?
- 我应该检查哪些设置/值,例如
getMaxTextMessageBufferSize()
等
最佳答案
检查 getMaxIdleTimeout()/setMaxIdleTimeout() 是否是您要找的。p>
来自 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/