From ccc8d68440c56fad53b499a4a54c6c5c2e5c59b3 Mon Sep 17 00:00:00 2001 From: Daniel Kec Date: Thu, 26 Oct 2023 09:27:36 +0200 Subject: [PATCH] #7886 WebSocket throws exception when client disconnects (#7890) --- .../main/java/io/helidon/webserver/websocket/WsConnection.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java index 9f9b11d6bee..e2b69fa8c77 100644 --- a/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java +++ b/webserver/websocket/src/main/java/io/helidon/webserver/websocket/WsConnection.java @@ -245,6 +245,8 @@ private ClientWsFrame readFrame() { try { // TODO check may payload size, danger of oom return ClientWsFrame.read(ctx, dataReader, Integer.MAX_VALUE); + } catch (DataReader.InsufficientDataAvailableException e) { + throw new CloseConnectionException("Socket closed by the other side", e); } catch (WsCloseException e) { close(e.closeCode(), e.getMessage()); throw new CloseConnectionException("WebSocket failed to read client frame", e);