[−][src]Struct wasm_sockets::PollingClient
Fields
url: String
The URL this client is connected to
event_client: EventClient
The core EventClient
this client is using
status: Rc<RefCell<ConnectionStatus>>
The current connection status
Implementations
impl PollingClient
[src]
pub fn new(url: &str) -> Result<Self, WebSocketError>
[src]
Create a new PollingClient and connect to a WebSocket URL
Note: An Ok() from this function does not mean the connection has succeeded.
PollingClient::new("wss://echo.websocket.org")?;
pub fn receive(&mut self) -> Vec<Message>
[src]
Get all new WebSocket messages that were received since this function was last called
println!("New messages: {:#?}", client.receive());
pub fn status(&self) -> ConnectionStatus
[src]
Get the client's current connection status
println!("Current status: {:#?}", client.status());
pub fn send_string(&self, message: &str) -> Result<(), JsValue>
[src]
Send a text message to the server
client.send_string("Hello server!")?;
pub fn send_binary(&self, message: Vec<u8>) -> Result<(), JsValue>
[src]
Send a binary message to the server
client.send_binary(vec![0x2, 0xF])?;
Auto Trait Implementations
impl !RefUnwindSafe for PollingClient
[src]
impl !Send for PollingClient
[src]
impl !Sync for PollingClient
[src]
impl Unpin for PollingClient
[src]
impl !UnwindSafe for PollingClient
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,