pub enum WsEvent {
Open,
Error,
Closing,
Closed(CloseEvent),
WsErr(WsErr),
}
Variants§
Open
The connection is now Open and ready for use.
Error
An error happened on the connection. For more information about when this event occurs, see the HTML Living Standard. Since the browser is not allowed to convey any information to the client code as to why an error happened (for security reasons), as described in the HTML specification, there usually is no extra information available. That’s why this event has no data attached to it.
Closing
The connection has started closing, but is not closed yet. You shouldn’t try to send messages over it anymore. Trying to do so will result in an error.
Closed(CloseEvent)
The connection was closed. The enclosed CloseEvent
has some extra information.
WsErr(WsErr)
An error happened, not on the connection, but inside ws_stream_wasm. This currently happens when an incoming message can not be converted to Rust types, eg. a String message with invalid encoding.
Implementations§
Source§impl WsEvent
impl WsEvent
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Predicate indicating whether this is a WsEvent::Open event. Can be used as a filter for the
event stream obtained with pharos::Observable::observe
on WsMeta
.
Sourcepub fn is_err(&self) -> bool
pub fn is_err(&self) -> bool
Predicate indicating whether this is a WsEvent::Error event. Can be used as a filter for the
event stream obtained with pharos::Observable::observe
on WsMeta
.
Sourcepub fn is_closing(&self) -> bool
pub fn is_closing(&self) -> bool
Predicate indicating whether this is a WsEvent::Closing event. Can be used as a filter for the
event stream obtained with pharos::Observable::observe
on WsMeta
.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Predicate indicating whether this is a WsEvent::Closed event. Can be used as a filter for the
event stream obtained with pharos::Observable::observe
on WsMeta
.
Sourcepub fn is_ws_err(&self) -> bool
pub fn is_ws_err(&self) -> bool
Predicate indicating whether this is a WsEvent::WsErr event. Can be used as a filter for the
event stream obtained with pharos::Observable::observe
on WsMeta
.