Crate websocket

Source
Expand description

Rust-WebSocket is a WebSocket (RFC6455) library written in Rust.

§Synchronous and Asynchronous

This crate has both async and sync implementations of websockets, you are free to choose which one you would like to use by switching on the async or sync features for this crate. By default both are switched on since they do not conflict with each other.

You’ll find many modules with ::sync and ::async submodules that separate these behaviours. Since it gets tedious to add these on when appropriate, a top-level convenience module called websocket::sync and websocket::async has been added that groups all the sync and async stuff, respectively.

§Clients

To make a client use the ClientBuilder struct, this builder has methods for creating both synchronous and asynchronous clients.

§Servers

WebSocket servers act similarly to the TcpListener, and listen for connections. See the Server struct documentation for more information. The bind() and bind_secure() functions will bind the server to the given SocketAddr.

§Extending Rust-WebSocket

The ws module contains the traits and functions used by Rust-WebSocket at a lower level. Their usage is explained in the module documentation.

Re-exports§

pub extern crate futures;
pub extern crate native_tls;
pub extern crate url;
pub extern crate websocket_base;
pub use self::client::builder::ClientBuilder;
pub use self::result::WebSocketResult;

Modules§

async
A collection of handy asynchronous-only parts of the crate.
client
Build and use asynchronously or synchronous websocket clients.
codec
Useful Codec types for asynchronously encoding and decoding messages.
dataframe
Module containing the default implementation of data frames.
header
Structs representing headers relevant in a WebSocket context.
message
Module containing the default implementation for messages.
receiver
The default implementation of a WebSocket Receiver.
result
The result type used within Rust-WebSocket
sender
The default implementation of a WebSocket Sender.
server
Provides an implementation of a WebSocket server
stream
Provides the default stream type for WebSocket connections.
sync
A collection of handy synchronous-only parts of the crate.
ws
A module containing the traits and structs that lower layer of Rust-WebSocket is based on.

Structs§

CloseData
Represents data contained in a Close message
Message
Represents a WebSocket message.

Enums§

OwnedMessage
Represents an owned WebSocket message.
WebSocketError
Represents a WebSocket error