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

标签 java websocket


我在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/

相关文章:

javascript - 使用存储为字符串的数字

java - 如何将枚举作为参数传递给函数?

java - 无法在 scala/java 中解压使用 Windows "Sent to compressed folder"创建的文件

php - Web 套接字从我的服务器获取实时数据

node.js - 无法加载资源: the server responded with a status of 426 (Upgrade Required)

javascript - webRTC - 多房间视频 session

java - 将 JSON 字符串反序列化为 POJO 列表

java - 为 ListView Android 设置 View 属性

java - 在 ASyncTask.execute() 之后从 Activity 执行 x()

flutter - socket_io_client 用于套接字连接多次触发