Expand description
An async Engine.IO v4 client: HTTP long polling and websocket transports, the upgrade probe, the heartbeat, and TLS through rustls (default) or native-tls.
This is the transport layer of the socket.io client; use it directly to talk raw engine.io.
use socketio_next::engineio::{ClientBuilder, Packet, PacketId};
use futures_util::StreamExt;
use url::Url;
let mut client = ClientBuilder::new(Url::parse("http://localhost:4201")?)
.build()
.await?;
client.connect().await?;
client.emit(Packet::new(PacketId::Message, "hello")).await?;
while let Some(packet) = client.next().await {
println!("{:?}", packet?);
}Re-exports§
pub use crate::protocol::engineio::HandshakePacket;pub use crate::protocol::engineio::Packet;pub use crate::protocol::engineio::PacketId;pub use tls::TlsConfig;
Modules§
- tls
- TLS backend selection for
https://andwss://connections. - transports
- The two engine.io transports.
Structs§
- Client
- An engine.io client: a
Streamof received packets plusemit. - Client
Builder - Configures and opens an engine.io
Client.
Enums§
- Error
- Everything that can go wrong in the engine.io client.
- Frame
- One unit read from a transport: a polling body or a websocket text frame (encoded packets), or a websocket binary frame (raw data of one binary message).
- Transport
- The transport of an engine.io session (enum dispatch, no boxed trait objects).
- Transport
Kind - Which transport a session runs on.
Constants§
- DEFAULT_
TIMEOUT - Default bound for the handshake and the websocket connect (socket.io-client
timeout, 20 s). - ENGINE_
IO_ VERSION - The engine.io protocol revision this client speaks (
EIO=4).
Type Aliases§
- Result
- Result alias of this crate.