@
stach 感谢大佬帮助。
协议文档上我们并没有规定空包为心跳包,我们目前有 100 多台终端都连到他的 ws 服务器,全都是没用回应空包的。我极度怀疑是服务器程序的问题。
我找到客户,拿到了报错的日志,就是在这个报错之后,客户端 ws 就会断开,然后不断重连:
16:07:29.445 [http-nio-8082-exec-8] ERROR c.g.l.s.WebSocketServer - [onError,78] - 发生错误
java.io.EOFException
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1208)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1142)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:72)
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171)
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$
Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$
WrappingRunnable.run(TaskThread.java:61)
at
java.lang.Thread.run(Thread.java:748)
16:07:29.445 [http-nio-8082-exec-8] INFO c.g.l.s.WebSocketServer - [onClose,58] - 连接 3110-440600-201112-0049 关闭!当前在线人数为 88
帮忙分析一些
感谢大佬耐心解答