pub struct SessionServer { /* private fields */ }Implementations§
Source§impl SessionServer
impl SessionServer
Sourcepub fn new(node_id: NodeId, config: RealtimeConfig) -> Self
pub fn new(node_id: NodeId, config: RealtimeConfig) -> Self
Create a new session server.
Sourcepub fn config(&self) -> &RealtimeConfig
pub fn config(&self) -> &RealtimeConfig
Get the configuration.
Sourcepub async fn register_connection(
&self,
session_id: SessionId,
sender: Sender<RealtimeMessage>,
)
pub async fn register_connection( &self, session_id: SessionId, sender: Sender<RealtimeMessage>, )
Register a new connection.
Sourcepub async fn remove_connection(
&self,
session_id: SessionId,
) -> Option<Vec<SubscriptionId>>
pub async fn remove_connection( &self, session_id: SessionId, ) -> Option<Vec<SubscriptionId>>
Remove a connection.
Sourcepub async fn add_subscription(
&self,
session_id: SessionId,
subscription_id: SubscriptionId,
) -> Result<()>
pub async fn add_subscription( &self, session_id: SessionId, subscription_id: SubscriptionId, ) -> Result<()>
Add a subscription to a connection.
Sourcepub async fn remove_subscription(&self, subscription_id: SubscriptionId)
pub async fn remove_subscription(&self, subscription_id: SubscriptionId)
Remove a subscription from a connection.
Sourcepub async fn send_to_session(
&self,
session_id: SessionId,
message: RealtimeMessage,
) -> Result<()>
pub async fn send_to_session( &self, session_id: SessionId, message: RealtimeMessage, ) -> Result<()>
Send a message to a specific session.
Sourcepub async fn broadcast_delta(
&self,
subscription_id: SubscriptionId,
delta: Delta<Value>,
) -> Result<()>
pub async fn broadcast_delta( &self, subscription_id: SubscriptionId, delta: Delta<Value>, ) -> Result<()>
Send a delta to all sessions subscribed to a subscription.
Sourcepub async fn connection_count(&self) -> usize
pub async fn connection_count(&self) -> usize
Get connection count.
Sourcepub async fn subscription_count(&self) -> usize
pub async fn subscription_count(&self) -> usize
Get subscription count.
Sourcepub async fn stats(&self) -> SessionStats
pub async fn stats(&self) -> SessionStats
Get server statistics.
Sourcepub async fn cleanup_stale(&self, max_idle: Duration)
pub async fn cleanup_stale(&self, max_idle: Duration)
Cleanup stale connections.
Auto Trait Implementations§
impl Freeze for SessionServer
impl !RefUnwindSafe for SessionServer
impl Send for SessionServer
impl Sync for SessionServer
impl Unpin for SessionServer
impl !UnwindSafe for SessionServer
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request