Module workflow_websocket::server
source · Expand description
async WebSocket server functionality (requires tokio executor)
Re-exports
Modules
Errorenum declaration for server-side WebSocket errors.- Module containing simple convenience handshake functions such as
greeting() - Result module encapsulating
Resultenum used by theWebSocketServer
Structs
- WebSocketServer that provides the main websocket connection and message processing loop that delivers messages to the installed WebSocketHandler trait.
Enums
- An enum representing the various forms of a WebSocket message.
Traits
- WebSocketHandler trait that represents the WebSocket processor functionality. This trait is supplied to the WebSocket which subsequently invokes it’s functions during websocket connection and messages. The trait can override
with_handshake()method to enable invocation of thehandshake()method upon receipt of the first valid websocket message from the incoming connection. - Base WebSocketServer trait allows the
WebSocketServer<T>struct to be retained by the trait reference by castring it to the trait as follows:
Type Definitions
- WebSocket stream receiver for receiving
tungstenite::Message. This stream object must have a mutable reference and can not be cloned. - WebSocket stream sender for dispatching
tungstenite::Message. This stream object must have a mutable reference and can not be cloned. - WebSocketSink
tokio::sync::mpsc::UnboundedSenderfor dispatching messages from within theWebSocketHandler::message. This is anMPSCchannel that can be cloned and retained externally for the lifetime of the WebSocket connection.