ClientSession class abstract
Client session on server
Shared, protocol-agnostic machinery for a single connected client:
- Handle incoming messages from the TransportConnection
- Send messages using the TransportConnection through a bounded OutboundQueue
- Monitor client liveness (Protocol.clientTimeout)
- Dispatch messages and lifecycle hooks to the ServerSyncPlugins
Concrete sessions implement handleTypedMessage with the protocol-specific message handling.
- Implementers
Constructors
-
ClientSession.base({required String id, required TransportConnection connection, Compressor? compressor, MessageCodec<
Message> ? messageCodec, int? maxBufferSize, List<ServerSyncPlugin> plugins = const []}) - Base constructor for concrete sessions.
Properties
-
events
→ Stream<
SessionEvent> -
Session events stream
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Session ID
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subscribedDocuments
→ List<
String> -
The documents the client is subscribed to
no setter
Methods
-
addSessionEvent(
SessionEvent event) → void - Emit a SessionEvent on events.
-
close(
) → Future< void> - Close the session
-
dispose(
) → void - Dispose the session
-
handleTypedMessage(
Message message) → Future< void> -
Handle a protocol
message, after plugin dispatch. -
handleUndecodable(
List< int> data) → void -
Called for an incoming
dataframe no codec could decode. -
isSubscribedTo(
String documentId) → bool -
Check if the client is subscribed to
documentId -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerDocument(
String documentId, {bool notifyPlugins = true}) → void -
Mark this session as subscribed to
documentId. -
sendMessage(
Message message) → Future< void> - Send a message to the client
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited