pub struct PushDispatcher { /* private fields */ }Expand description
推送分发器
Implementations§
Source§impl PushDispatcher
impl PushDispatcher
pub fn new( connections: Arc<DashMap<u64, ClientConn>>, subscriptions: Arc<SubscriptionManager>, ) -> Self
Sourcepub fn with_metrics(self, metrics: Arc<GatewayMetrics>) -> Self
pub fn with_metrics(self, metrics: Arc<GatewayMetrics>) -> Self
设置监控指标引用
Sourcepub fn with_external_sink(self, sink: Arc<dyn ExternalPushSink>) -> Self
pub fn with_external_sink(self, sink: Arc<dyn ExternalPushSink>) -> Self
添加外部推送接收器(可多次调用注册多个)
Sourcepub async fn push_to_conn(&self, conn_id: u64, proto_id: u32, body: Vec<u8>)
pub async fn push_to_conn(&self, conn_id: u64, proto_id: u32, body: Vec<u8>)
向指定连接推送(自动处理 AES 加密)
Sourcepub async fn push_notify(&self, proto_id: u32, body: Vec<u8>)
pub async fn push_notify(&self, proto_id: u32, body: Vec<u8>)
向所有订阅了通知的连接广播(每个连接独立 AES 加密)
Sourcepub async fn push_broadcast(&self, proto_id: u32, body: Vec<u8>)
pub async fn push_broadcast(&self, proto_id: u32, body: Vec<u8>)
向所有已连接的客户端广播(到价提醒等,不需要订阅通知) C++ 检查 IsConnSubRecvNotify,对齐使用 is_subscribed_notify
Auto Trait Implementations§
impl Freeze for PushDispatcher
impl !RefUnwindSafe for PushDispatcher
impl Send for PushDispatcher
impl Sync for PushDispatcher
impl Unpin for PushDispatcher
impl !UnwindSafe for PushDispatcher
Blanket Implementations§
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