Skip to content

Commit

Permalink
SCB-2099 Solve the problem of watch fail
Browse files Browse the repository at this point in the history
  • Loading branch information
develpoerX committed Oct 26, 2020
1 parent d4e2a7c commit fe58dbc
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -27,6 +27,7 @@
import io.vertx.core.Handler;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.WebSocket;
import io.vertx.core.http.WebSocketConnectOptions;

/**
Expand All @@ -52,18 +53,19 @@ public static void open(IpPort ipPort, String url, Handler<Void> onOpen, Handler
onConnectFailed.handle(asyncResult.cause());
} else {
onOpen.handle(null);
asyncResult.result().exceptionHandler(v -> {
WebSocket webSocket = asyncResult.result();
webSocket.exceptionHandler(v -> {
onException.handle(v);
try {
asyncResult.result().close();
} catch (Exception err) {
LOGGER.error("ws close error.", err);
}
});
asyncResult.result().closeHandler(v -> {
webSocket.closeHandler(v -> {
onClose.handle(v);
});
asyncResult.result().pongHandler(pong -> {
webSocket.pongHandler(pong -> {
// ignore, just prevent NPE.
});
asyncResult.result().frameHandler((frame) -> onMessage.handle(frame.binaryData()));
Expand Down

0 comments on commit fe58dbc

Please sign in to comment.