Struct stateroom_server::ClientSocketConnection
source · pub struct ClientSocketConnection {
pub room: Recipient<MessageFromClient>,
pub client_id: ClientId,
pub last_seen: Instant,
pub heartbeat_interval: Duration,
pub heartbeat_timeout: Duration,
pub interval_handle: Option<SpawnHandle>,
}Expand description
Represents a connection from a service to a client, which consists of a message receiver and a user ID.
Fields§
§room: Recipient<MessageFromClient>§client_id: ClientId§last_seen: Instant§heartbeat_interval: Duration§heartbeat_timeout: Duration§interval_handle: Option<SpawnHandle>Trait Implementations§
source§impl Actor for ClientSocketConnection
impl Actor for ClientSocketConnection
§type Context = WebsocketContext<ClientSocketConnection>
type Context = WebsocketContext<ClientSocketConnection>
Actor execution context type
source§fn started(&mut self, ctx: &mut Self::Context)
fn started(&mut self, ctx: &mut Self::Context)
Called when an actor gets polled the first time.
source§impl StreamHandler<Result<Message, ProtocolError>> for ClientSocketConnection
impl StreamHandler<Result<Message, ProtocolError>> for ClientSocketConnection
source§fn handle(&mut self, msg: Result<Message, ProtocolError>, ctx: &mut Self::Context)
fn handle(&mut self, msg: Result<Message, ProtocolError>, ctx: &mut Self::Context)
Called for every message emitted by the stream.
source§fn add_stream<S>(stream: S, ctx: &mut Self::Context) -> SpawnHandlewhere
S: Stream + 'static,
Self: StreamHandler<<S as Stream>::Item>,
Self::Context: AsyncContext<Self>,
fn add_stream<S>(stream: S, ctx: &mut Self::Context) -> SpawnHandlewhere S: Stream + 'static, Self: StreamHandler<<S as Stream>::Item>, Self::Context: AsyncContext<Self>,
Register a Stream to the actor context.