std::net::websocketWebSocket client for bidirectional communication.
Provides a blocking WebSocket client that can send and receive text messages over a persistent connection.
import std::net::websocket;
fn main() {
let ws = websocket.connect("ws://localhost:8080/ws");
ws.send_text("hello");
let msg = ws.recv();
msg.free();
ws.close();
}
connectOpen a WebSocket connection to the given URL.
let ws = websocket.connect("ws://localhost:8080/ws");
ConnAn open WebSocket connection handle.
Created by calling websocket.connect(url). Use send_text() to
send messages and recv() to receive them.
MessageAn incoming WebSocket message handle.
Obtained from conn.recv(). Must be freed with free() when no
longer needed.
ConnMethodsMethods available on a WebSocket Conn.
MessageMethodsMethods available on a WebSocket Message.