Crate tungstenite
Expand description
Lightweight, flexible WebSockets for Rust.
Modules§
- buffer
- A buffer for reading data from the network.
- client
- Methods to connect to a WebSocket as a client.
- error
- Error handling.
- handshake
- WebSocket handshake control.
- http
- A general purpose library of common HTTP types
- protocol
- Generic WebSocket message stream.
- stream
- Convenience wrapper for streams to switch between plain TCP and TLS at runtime.
- util
- Helper traits to ease non-blocking handling.
Structs§
- Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
- Client
Handshake - Client handshake role.
- Client
Request Builder - Builder for a custom
IntoClientRequestwith options to add custom additional headers and sub protocols. - Server
Handshake - Server handshake role.
- Utf8
Bytes - Utf8 payload.
- WebSocket
- WebSocket input-output stream.
Enums§
- Connector
- A connector that can be used when establishing connections, allowing to control whether
native-tlsorrustlsis used to create a TLS connection. Or TLS can be disabled with thePlainvariant. - Error
- Possible WebSocket errors.
- Handshake
Error - A handshake result.
- Message
- An enum representing the various forms of a WebSocket message.
Functions§
- accept
- Accept the given Stream as a WebSocket.
- accept_
hdr - Accept the given Stream as a WebSocket.
- accept_
hdr_ with_ config - Accept the given Stream as a WebSocket.
- accept_
with_ config - Accept the given Stream as a WebSocket.
- client
- Do the client handshake over the given stream.
- client_
tls - Creates a WebSocket handshake from a request and a stream, upgrading the stream to TLS if required.
- client_
tls_ with_ config - The same as
client_tls()but one can specify a websocket configuration, and an optional connector. If no connector is specified, a default one will be created. - connect
- Connect to the given WebSocket in blocking mode.
Type Aliases§
- Result
- Result type of all Tungstenite library calls.