Send Pong via scheduler for the session
Single threaded scheduler for serial sending, avoiding concurrent sends that are not allowed by the WebSocket runtime. Closes gh-793
This commit is contained in:
@@ -213,7 +213,15 @@ public class GraphQlWebSocketHandler extends TextWebSocketHandler implements Sub
|
||||
.publishOn(state.getScheduler()) // Serial blocking send via single thread
|
||||
.subscribe(new SendMessageSubscriber(id, session, state));
|
||||
}
|
||||
case PING -> session.sendMessage(encode(GraphQlWebSocketMessage.pong(null)));
|
||||
case PING ->
|
||||
state.getScheduler().schedule(() -> {
|
||||
try {
|
||||
session.sendMessage(encode(GraphQlWebSocketMessage.pong(null)));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ExceptionWebSocketHandlerDecorator.tryCloseWithError(session, ex, logger);
|
||||
}
|
||||
});
|
||||
case COMPLETE -> {
|
||||
if (id != null) {
|
||||
Subscription subscription = state.getSubscriptions().remove(id);
|
||||
|
||||
Reference in New Issue
Block a user