RelicWebSocketBase class abstract base

What every RelicWebSocket over a framing transport shares: the events the handler reads, the send and close guards, the going-away close and the ping timer.

A transport provides sendFrame and reports what it received through addEvent, pongReceived, closeEvents and completeDone.

Implemented types
Implementers

Constructors

RelicWebSocketBase()

Properties

closeSent → bool
Whether a close frame of this side's is on its way or went out.
no setter
done → Future<void>
Completes once the connection is closed, whoever closed it.
no setteroverride
events → Stream<WebSocketEvent>
A Stream of WebSocketEvent received from the peer.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isClosed → bool
Whether the web-socket is closed.
no setteroverride
pingInterval ↔ Duration?
The interval at which ping frames are sent to keep the web-socket connection alive.
getter/setter pairoverride
protocol → String
The WebSocket subprotocol negotiated with the peer.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addError(Object error, [StackTrace? stackTrace]) → void
Hands the handler an error, unless its events ended.
addEvent(WebSocketEvent event) → void
Hands the handler an event, unless its events ended.
close([int? code, String? reason]) → Future<void>
Closes the WebSocket connection and the events Stream.
closeEvents([CloseReceived? close]) → void
Ends the handler's events, after close when it should hear how the connection closed.
completeDone() → void
Completes done and stops the ping timer, once the connection is over.
goAway(int code, String reason) → void
Closes from this side with code, and the handler sees that close.
markCloseSent() → void
Records a close the transport sent on this side's behalf, such as the echo of the peer's close frame.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCloseSent() → void
Called once a close frame of this side's went out.
onPeerUnresponsive() → void
Called after the socket closed with 1001 on a peer that let a ping go unanswered, which will not answer the close frame either.
onPing() → void
Called when a ping goes out.
pingAnswered() → bool
Whether the peer answered the last ping, asked when the next is due.
pongReceived() → void
Records that the peer answered a ping.
sendBytes(Uint8List b) → void
Sends binary data to the connected peer.
sendClose(int? code, String reason) → void
Sends a close frame once.
sendFrame(WebSocketOpcode opcode, Uint8List payload) → void
Sends one frame to the peer.
sendText(String s) → void
Sends text data to the connected peer.
toString() → String
A string representation of this object.
inherited
tryClose([int? code, String? reason]) → Future<bool>
Try to close the WebSocket connection and the events Stream.
override
trySendBytes(Uint8List b) → bool
Sends binary data to the peer, unless connection is already closed (either through close or by the peer). Returns false if connection is known to be closed, otherwise true.
override
trySendText(String s) → bool
Sends text data to the peer, unless connection is already closed (either through close or by the peer). Returns false if connection is known to be closed, otherwise true.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited