lustre_websocket
Types
pub type WebSocketCloseReason {
Normal
GoingAway
ProtocolError
UnexpectedTypeOfData
NoCodeFromServer
AbnormalClose
IncomprehensibleFrame
PolicyViolated
MessageTooBig
FailedExtensionNegotation
UnexpectedFailure
FailedTLSHandshake
OtherCloseReason
}
Constructors
-
Normal
-
GoingAway
-
ProtocolError
-
UnexpectedTypeOfData
-
NoCodeFromServer
-
AbnormalClose
-
IncomprehensibleFrame
-
PolicyViolated
-
MessageTooBig
-
FailedExtensionNegotation
-
UnexpectedFailure
-
FailedTLSHandshake
-
OtherCloseReason
pub type WebSocketEvent {
OnOpen(WebSocket)
OnMessage(String)
OnClose(WebSocketCloseReason)
}
Constructors
-
OnOpen(WebSocket)
-
OnMessage(String)
-
OnClose(WebSocketCloseReason)
Functions
pub fn init(
path: String,
wrapper: fn(WebSocketEvent) -> a,
) -> Effect(a)
Initialize a websocket. These constructs are fully asynchronous, so you must provide a wrapper
that takes a WebSocketEvent
and turns it into a lustre message of your application.