pub struct PollingClient {
    pub url: String,
    pub event_client: EventClient,
    pub status: Rc<RefCell<ConnectionStatus>>,
    /* private fields */
}

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

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://ws.ifelse.io")?;

Get all new WebSocket messages that were received since this function was last called

println!("New messages: {:#?}", client.receive());

Get the client’s current connection status

println!("Current status: {:#?}", client.status());

Send a text message to the server

client.send_string("Hello server!")?;

Send a binary message to the server

client.send_binary(vec![0x2, 0xF])?;

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.