使用的
<dependency> <groupId>org.java-websocket</groupId> <artifactId>Java-WebSocket</artifactId> <version>1.5.1</version> </dependency>
作为 websocket 客户端,server 端使用的
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency
server 端放在 k8s 上,以 pod 的方式启动,没有 nginx.
目前情况是我 client 端每隔一分钟发送一次 ping 信息,但是 websocket 连接还是在一个小时后断开,client 端收到的 code 是 1006 ,请问有大佬知道怎么回事吗?应该怎么避免呢?
因为我们的业务是先建立 websocket 连接,然后请求 rest 接口,rest 接口 http 连接会在 10 分钟后超时,所以我们期望 rest 接口业务完成后(大概率一个小时以上)通过 websocket 推消息,但目前 websocket 会在一个小时后断开,极端情况下 websocket 重连的同时 rest 接口完成了,这样就会导致 websocket 收到不消息,请问各位大佬有啥解决办法吗?