sms_client/ws/events.rs
1//! WebSocket event kinds (server or client generated).
2
3/// An event passed to on_message (or variant). This represents an event
4/// that could either be from the SMS server or the client (reconnection).
5#[derive(Debug, Clone, PartialEq)]
6pub enum WebsocketEvent {
7 /// An event received from the server.
8 Server(sms_types::events::Event),
9
10 /// A reconnection event created by client worker.
11 Reconnection(WebsocketReconnectionKind),
12}
13
14/// A client generated event for Websocket connection state updates.
15#[derive(Debug, Clone, PartialEq)]
16pub enum WebsocketReconnectionKind {
17 /// The websocket is now connected.
18 Connected,
19
20 /// The websocket is disconnected, the contained value is if
21 /// automatic reconnection will be attempted.
22 Disconnected(bool),
23}