Fixed ping bug
This commit is contained in:
@@ -58,14 +58,33 @@ public class SessionListener implements WebSocket.Listener {
|
|||||||
new RuntimeException(r.error().toString()));
|
new RuntimeException(r.error().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ws.request(1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOpen(WebSocket ws) {
|
||||||
|
ws.request(1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletionStage<?> onPing(WebSocket ws, ByteBuffer message) {
|
public CompletionStage<?> onPing(WebSocket ws, ByteBuffer message) {
|
||||||
|
ws.request(1);
|
||||||
return ws.sendPong(message);
|
return ws.sendPong(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletionStage<?> onPong(WebSocket ws, ByteBuffer message) {
|
||||||
|
ws.request(1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletionStage<?> onClose(WebSocket ws, int statusCode, String reason) {
|
||||||
|
ws.request(1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
void send(WebSocket ws, Message msg) throws Exception {
|
void send(WebSocket ws, Message msg) throws Exception {
|
||||||
ws.sendText(mapper.writeValueAsString(msg), true);
|
ws.sendText(mapper.writeValueAsString(msg), true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user