mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Set a more sane timeout for WS connections and log WS errors (#1992)
This commit is contained in:
@@ -69,8 +69,7 @@ public class DataSocketHandler {
|
||||
|
||||
public void onConnect(WsConnectContext context) {
|
||||
users.add(context);
|
||||
context.session.setIdleTimeout(
|
||||
Duration.ofMillis(Long.MAX_VALUE)); // TODO: determine better value
|
||||
context.session.setIdleTimeout(Duration.ofMillis(5000));
|
||||
var remote = (InetSocketAddress) context.session.getRemoteAddress();
|
||||
var host = remote.getAddress().toString() + ":" + remote.getPort();
|
||||
logger.info("New websocket connection from " + host);
|
||||
|
||||
@@ -109,6 +109,7 @@ public class Server {
|
||||
ws -> {
|
||||
ws.onConnect(dsHandler::onConnect);
|
||||
ws.onClose(dsHandler::onClose);
|
||||
ws.onError(e -> logger.error(e.toString(), e.error()));
|
||||
ws.onBinaryMessage(dsHandler::onBinaryMessage);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user