Skip to content

Commit 9dec253

Browse files
committed
websocket: WebSocketConfigurer#onClose not called
- fixed for undertow and jetty. - netty doesn't fire the client disconnected event - fix #3111
1 parent d54d008 commit 9dec253

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

modules/jooby-jetty/src/main/java/io/jooby/internal/jetty/JettyWebSocket.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,9 @@ public void onWebSocketText(String message) {
121121

122122
@Override
123123
public void onWebSocketClose(int statusCode, String reason) {
124-
if (onCloseCallback != null) {
125-
handleClose(
126-
WebSocketCloseStatus.valueOf(statusCode)
127-
.orElseGet(() -> new WebSocketCloseStatus(statusCode, reason)));
128-
}
124+
handleClose(
125+
WebSocketCloseStatus.valueOf(statusCode)
126+
.orElseGet(() -> new WebSocketCloseStatus(statusCode, reason)));
129127
}
130128

131129
@Override

modules/jooby-undertow/src/main/java/io/jooby/internal/undertow/UndertowWebSocket.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,9 @@ protected void onError(WebSocketChannel channel, Throwable x) {
359359

360360
@Override
361361
protected void onCloseMessage(CloseMessage cm, WebSocketChannel channel) {
362-
if (isOpen()) {
363-
handleClose(
364-
WebSocketCloseStatus.valueOf(cm.getCode())
365-
.orElseGet(() -> new WebSocketCloseStatus(cm.getCode(), cm.getReason())));
366-
}
362+
handleClose(
363+
WebSocketCloseStatus.valueOf(cm.getCode())
364+
.orElseGet(() -> new WebSocketCloseStatus(cm.getCode(), cm.getReason())));
367365
}
368366

369367
private void handleClose(WebSocketCloseStatus status) {

0 commit comments

Comments
 (0)