Refine search
var ws = new WebSocket("ws://example.com/path", "protocol-name");
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } }, failureHandler);
class Connector { public string msg { get; set; } public event EventHandler MessageReceived; WebSocket websocket = new WebSocket("ws://192.168.1.103:2012/"); public void Connect() { websocket.Opened += new EventHandler(websocket_Opened); websocket.MessageReceived += new EventHandler<MessageReceivedEventArgs>(websocket_MessageReceived); websocket.Open(); } private void websocket_MessageReceived(object sender, MessageReceivedEventArgs e) { msg = e.Message; if(MessageReceived != null) MessageReceived(this, EventArgs.Empty); } private void websocket_Opened(object sender, EventArgs e) { websocket.Send("Status"); } }
public synchronized io.vertx.rx.java.WriteStreamSubscriber<io.vertx.rxjava.core.buffer.Buffer> toSubscriber() { if (subscriber == null) { java.util.function.Function<io.vertx.rxjava.core.buffer.Buffer, io.vertx.core.buffer.Buffer> conv = io.vertx.rxjava.core.buffer.Buffer::getDelegate; subscriber = io.vertx.rx.java.RxHelper.toSubscriber(getDelegate(), conv); } return subscriber; }
@Test public void testWebsocketClient() { HttpServer server = vertx.createHttpServer(new HttpServerOptions().setPort(8080)); server.websocketStream().handler(ws -> { ws.write(Buffer.buffer("some_content")); ws.close(); }); server.listen(ar -> { HttpClient client = vertx.createHttpClient(new HttpClientOptions()); client.websocket(8080, "localhost", "/the_uri", ws -> { Buffer content = Buffer.buffer(); Observable<Buffer> observable = ws.toObservable(); observable.forEach(content::appendBuffer, err -> fail(), () -> { server.close(); assertEquals("some_content", content.toString("UTF-8")); testComplete(); }); }); }); await(); }
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } });
public synchronized io.vertx.rx.java.WriteStreamSubscriber<io.vertx.rxjava.core.buffer.Buffer> toSubscriber() { if (subscriber == null) { java.util.function.Function<io.vertx.rxjava.core.buffer.Buffer, io.vertx.core.buffer.Buffer> conv = io.vertx.rxjava.core.buffer.Buffer::getDelegate; subscriber = io.vertx.rx.java.RxHelper.toSubscriber(getDelegate(), conv); } return subscriber; }
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } }, failureHandler);
if (window.WebSocket) { var ws = new WebSocket("ws://example.com/contextname/push"); ws.onmessage = function(event) { var text = event.data; console.log(text); }; } else { // Bad luck. Browser doesn't support it. Consider falling back to long polling. // See http://caniuse.com/websockets for an overview of supported browsers. // There exist jQuery WebSocket plugins with transparent fallback. }
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } });
var exampleSocket = new WebSocket("wss://localhost:8001", "protocolOne"); exampleSocket.onerror = function(e) { console.log(e); }
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } });
var websocket = new WebSocket("server address"); websocket.onmessage = function(str) { console.log("Someone sent: ", str); }; // Tell the server this is client 1 (swap for client 2 of course) websocket.send(JSON.stringify({ id: "client1" })); // Tell the server we want to send something to the other client websocket.send(JSON.stringify({ to: "client2", data: "foo" }));
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } });
new WebSocket("ws://localhost:8001", "protocolOne");
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } });
if ("WebSocket" in window) websocket = new WebSocket("ws://yourDomainNameHere.org/");
public void handle(io.vertx.core.http.WebSocket event) { wsConnect.handle(io.vertx.rxjava.core.http.WebSocket.newInstance(event)); } });
connection = new WebSocket("ws://localhost:2005/");