Registry / networking / tungstenite

tungstenite

JSON →
library0.29.0rscratesunverified

Lightweight stream-based WebSocket implementation.

# Cargo.toml [dependencies] tungstenite = "0.29.0"
INSTALL
IMPORT
SIG · TUNGSTENITE
T
tungstenite
networkingrustv0.29.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebSocket
use tungstenite::WebSocket;

Connect to a WebSocket server and send/receive messages.

use tungstenite::{connect, Message}; use url::Url; fn main() { let (mut socket, response) = connect(Url::parse("ws://echo.websocket.org").unwrap()).unwrap(); socket.write_message(Message::Text("Hello".into())).unwrap(); let msg = socket.read_message().unwrap(); println!("Received: {}", msg); }
Debug
Known issues
gotchaRequires an async runtime (tokio or async-std) for non-blocking I/O.
fix
Use tokio::main or async-std::main and enable the appropriate feature.
affects: *
Upgrade
Version history
0.29.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
tungstenite — cargo add tungstenite · libregistry