Skip to content

Commit 10ea73d

Browse files
committed
Handle PONG messages in WebSocket handlers
See gh-534
1 parent 74688ea commit 10ea73d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

spring-graphql/src/main/java/org/springframework/graphql/server/webflux/GraphQlWebSocketHandler.java

+3
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ public Mono<Void> handle(WebSocketSession session) {
183183
case PING -> {
184184
return Flux.just(this.codecDelegate.encode(session, GraphQlWebSocketMessage.pong(null)));
185185
}
186+
case PONG -> {
187+
return Flux.empty();
188+
}
186189
case COMPLETE -> {
187190
if (id != null) {
188191
Subscription subscription = subscriptions.remove(id);

spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandler.java

+2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ private void handleInternal(WebSocketSession session, TextMessage webSocketMessa
248248
ExceptionWebSocketHandlerDecorator.tryCloseWithError(session, ex, logger);
249249
}
250250
});
251+
case PONG -> {
252+
}
251253
case COMPLETE -> {
252254
if (id != null) {
253255
Subscription subscription = state.getSubscriptions().remove(id);

0 commit comments

Comments
 (0)