Skip to main content

Crate socket_io_client

Crate socket_io_client 

Source
Expand description

一个简易的 Socket.IO 客户端库。 A simple Socket.IO client library.

提供了类似 socketioxide 的服务端开发体验,包括通过 ClientApp 管理全局状态、 Provides a server-side development experience similar to socketioxide, including managing global state through ClientApp, 注册不同命名空间(Namespace)以及基于 Extractor 机制的事件路由注册方法。 registering different namespaces (Namespace), and event routing registration methods based on the Extractor mechanism.

核心组件: Core components:

  • ClientApp - 客户端主容器,负责管理各个命名空间及断线重连逻辑。
  • ClientApp - Main client container, responsible for managing namespaces and auto-reconnection logic.
  • ClientSocketRef - 代表一个关联到特定命名空间的 Socket 引用,可用于发送事件及加入房间。
  • ClientSocketRef - Represents a Socket reference associated with a specific namespace, which can be used to emit events and join rooms.
  • Extractor 机制:通过 Socket, Data, State, Ack 自动提取事件参数。
  • Extractor mechanism: Automatically extracts event parameters via Socket, Data, State, Ack.

Re-exports§

pub use client_app::ClientApp;
pub use client_socket_ref::ClientSocketRef;
pub use extractor::Ack;
pub use extractor::Data;
pub use extractor::Extractor;
pub use extractor::Raw;
pub use extractor::Socket;
pub use extractor::State;
pub use socket_io_client::IncomingEvent;
pub use socket_io_client::SocketIOClient;

Modules§

client_app
客户端主容器,支持全局状态及命名空间管理。 Main client container, supports global state and namespace management. 客户端 App 容器组件。 Client App container component.
client_socket_ref
绑定了命名空间的 Socket 引用对象。 Socket reference object bound to a namespace. 客户端 Socket 引用组件。 Client Socket reference component.
codec
Socket.IO 协议编码解码函数辅助库。 Socket.IO protocol encoding and decoding function helper library. Socket.IO 协议的报文编解码辅助。 Socket.IO protocol packet encoding and decoding helpers.
extractor
事件处理参数自动提取器(Extractor)。 Automatic event handler parameter extractors. 参数提取器(Extractor)机制组件。 Parameter extractor mechanism component.
socket_io_client
Socket.IO 底层协议的 WebSocket 和 Polling 传输实现。 WebSocket and Polling transport implementation of the underlying Socket.IO protocol. 底层 Socket.IO 协议传输客户端实现。 Underlying Socket.IO protocol transport client implementation.