pub struct ClientBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn on_message<F>(self, handler: F) -> Self
pub fn on_message<F>(self, handler: F) -> Self
Sourcepub fn with_protocol(self, protocol: TransportProtocol) -> Self
pub fn with_protocol(self, protocol: TransportProtocol) -> Self
设置传输协议
Sourcepub fn with_protocol_race(self, protocols: Vec<TransportProtocol>) -> Self
pub fn with_protocol_race(self, protocols: Vec<TransportProtocol>) -> Self
启用多协议竞速
协议列表的顺序就是优先级顺序,前面的协议优先级更高
Sourcepub fn with_protocol_url(self, protocol: TransportProtocol, url: String) -> Self
pub fn with_protocol_url(self, protocol: TransportProtocol, url: String) -> Self
为特定协议设置服务器地址
Sourcepub fn with_user_id(self, user_id: String) -> Self
pub fn with_user_id(self, user_id: String) -> Self
设置用户 ID
Sourcepub fn with_device_info(self, device_info: DeviceInfo) -> Self
pub fn with_device_info(self, device_info: DeviceInfo) -> Self
设置设备信息(CONNECT 协商与设备管理)
Sourcepub fn with_token(self, token: String) -> Self
pub fn with_token(self, token: String) -> Self
设置 Token(用于认证,如果服务端启用认证,必须提供)
Sourcepub fn with_format(self, format: SerializationFormat) -> Self
pub fn with_format(self, format: SerializationFormat) -> Self
设置序列化格式
Sourcepub fn with_compression(self, compression: CompressionAlgorithm) -> Self
pub fn with_compression(self, compression: CompressionAlgorithm) -> Self
设置压缩算法
Sourcepub fn with_heartbeat(self, heartbeat: HeartbeatConfig) -> Self
pub fn with_heartbeat(self, heartbeat: HeartbeatConfig) -> Self
设置心跳配置
Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
设置连接超时
Sourcepub fn with_reconnect_interval(self, interval: Duration) -> Self
pub fn with_reconnect_interval(self, interval: Duration) -> Self
设置重连间隔
Sourcepub fn with_max_reconnect_attempts(self, max: Option<u32>) -> Self
pub fn with_max_reconnect_attempts(self, max: Option<u32>) -> Self
设置最大重连次数
Sourcepub fn enable_router(self) -> Self
pub fn enable_router(self) -> Self
启用消息路由
启用后,可以通过 ClientCore 的 router 方法注册消息处理器
Sourcepub fn build(self) -> Result<SimpleClient>
pub fn build(self) -> Result<SimpleClient>
Auto Trait Implementations§
impl !RefUnwindSafe for ClientBuilder
impl !UnwindSafe for ClientBuilder
impl Freeze for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more