RealtimeSessionScope class
Scope managing the lifecycle of an ongoing realtime connection (WebSocket, SSE).
Constructors
- RealtimeSessionScope({required RealtimeTrafficCollector collector, required String sessionId, Uri? uri, RealtimeProtocolType protocolType = RealtimeProtocolType.webSocket, bool? shouldCapture})
-
Creates a RealtimeSessionScope for tracking traffic over
sessionId.
Properties
- canSend → bool
-
Whether message transmission is currently permitted.
no setter
- collector → RealtimeTrafficCollector
-
The collector coordinating storage.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether this session has been closed.
no setter
- protocolType → RealtimeProtocolType
-
Protocol type for this realtime connection.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sender → RealtimeConnectionSender?
-
The active sender delegate, if attached.
no setter
- sessionId → String
-
Unique identifier of this realtime connection session.
final
- uri → Uri?
-
Target URI of the connection, if provided.
final
Methods
-
attachSender(
RealtimeConnectionSender sender) → void -
Attaches a
sendercapable of transmitting messages over this connection. -
close(
{int? code, String? reason}) → void - Records the connection closure. Safe and idempotent.
-
detachSender(
) → void - Detaches the current sender delegate.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
receive(
dynamic data, {String? eventName}) → void - Records an incoming frame received from the server. Safe to call.
-
send(
dynamic data, {String? eventName}) → void - Records an outgoing frame sent to the server. Safe to call.
-
sendToServer(
RealtimeMessageDraft draft) → Future< void> -
Transmits
draftthrough the attached sender to the server. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited