public SockJSSocket handler(Handler<Buffer> handler) { ws.binaryMessageHandler(handler); ws.textMessageHandler(textMessage -> handler.handle(Buffer.buffer(textMessage))); return this; }
WebSocketListener(ServerWebSocket ws, SockJSSession session) { this.ws = ws; this.session = session; ws.textMessageHandler(this::handleMessages); ws.closeHandler(v -> { closed = true; session.shutdown(); }); ws.exceptionHandler(t -> { closed = true; session.shutdown(); session.handleException(t); }); }
/** * Set a text message handler on the connection. This handler will be called similar to the * , but the buffer will be converted to a String first * @param handler the handler * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.http.WebSocketBase textMessageHandler(Handler<String> handler) { delegate.textMessageHandler(handler); return this; }
/** * Set a text message handler on the connection. This handler will be called similar to the * {@link io.vertx.rxjava.core.http.WebSocketBase#binaryMessageHandler}, but the buffer will be converted to a String first * @param handler the handler * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.http.WebSocketBase textMessageHandler(Handler<String> handler) { delegate.textMessageHandler(handler); return this; }
public SockJSSocket handler(Handler<Buffer> handler) { ws.binaryMessageHandler(handler); ws.textMessageHandler(textMessage -> handler.handle(Buffer.buffer(textMessage))); return this; }
WebSocketListener(ServerWebSocket ws, SockJSSession session) { this.ws = ws; this.session = session; ws.textMessageHandler(this::handleMessages); ws.closeHandler(v -> { closed = true; session.shutdown(); }); ws.exceptionHandler(t -> { closed = true; session.shutdown(); session.handleException(t); }); }