pub struct ChannelBridgeHandler<H: ExchangeHandler, R: MessageRouter> { /* private fields */ }Expand description
Channel bridge handler
Implementations§
Source§impl<H: ExchangeHandler, R: MessageRouter> ChannelBridgeHandler<H, R>
impl<H: ExchangeHandler, R: MessageRouter> ChannelBridgeHandler<H, R>
Sourcepub fn register_subscription(
&self,
key: String,
sender: UnboundedSender<Box<dyn Any + Send>>,
subscription_type: SubscriptionType,
)
pub fn register_subscription( &self, key: String, sender: UnboundedSender<Box<dyn Any + Send>>, subscription_type: SubscriptionType, )
Register a subscription channel
Sourcepub fn unregister_subscription(&self, key: &str) -> Option<SubscriptionChannel>
pub fn unregister_subscription(&self, key: &str) -> Option<SubscriptionChannel>
Unregister a subscription
Sourcepub fn subscription_count(&self) -> usize
pub fn subscription_count(&self) -> usize
Get the number of active subscriptions
Sourcepub fn clear_subscriptions(&self)
pub fn clear_subscriptions(&self)
Clear all subscriptions
Trait Implementations§
Source§impl<H: ExchangeHandler, R: MessageRouter> ExchangeHandler for ChannelBridgeHandler<H, R>
impl<H: ExchangeHandler, R: MessageRouter> ExchangeHandler for ChannelBridgeHandler<H, R>
Source§fn get_subscriptions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subscriptions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get subscription messages
Source§fn authenticate<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle authentication if required
Source§fn requires_auth(&self) -> bool
fn requires_auth(&self) -> bool
Check if the connection needs authentication
Source§fn get_heartbeat(&self) -> Option<Message>
fn get_heartbeat(&self) -> Option<Message>
Get heartbeat message if required
Source§fn heartbeat_interval(&self) -> Option<Duration>
fn heartbeat_interval(&self) -> Option<Duration>
Get heartbeat interval
Source§impl<H: ExchangeHandler, R: MessageRouter> MessageHandler for ChannelBridgeHandler<H, R>
impl<H: ExchangeHandler, R: MessageRouter> MessageHandler for ChannelBridgeHandler<H, R>
Source§fn on_message<'life0, 'async_trait>(
&'life0 mut self,
message: Message,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_message<'life0, 'async_trait>(
&'life0 mut self,
message: Message,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a received message
Source§fn on_connected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_connected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle connection established
Source§fn on_disconnected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_disconnected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle connection closed
Source§fn on_error<'life0, 'async_trait>(
&'life0 mut self,
error: WebSocketError,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_error<'life0, 'async_trait>(
&'life0 mut self,
error: WebSocketError,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle errors
Source§fn set_sender(&mut self, _sender: UnboundedSender<Message>)
fn set_sender(&mut self, _sender: UnboundedSender<Message>)
Set the sender for outgoing messages (optional, default implementation does nothing)
Source§fn send_message(&self, _message: Message) -> WebSocketResult<()>
fn send_message(&self, _message: Message) -> WebSocketResult<()>
Send a message through the WebSocket (optional, default implementation returns error)
Auto Trait Implementations§
impl<H, R> Freeze for ChannelBridgeHandler<H, R>
impl<H, R> !RefUnwindSafe for ChannelBridgeHandler<H, R>
impl<H, R> Send for ChannelBridgeHandler<H, R>
impl<H, R> Sync for ChannelBridgeHandler<H, R>
impl<H, R> Unpin for ChannelBridgeHandler<H, R>
impl<H, R> !UnwindSafe for ChannelBridgeHandler<H, R>
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