StreamingConnectionHandler class

The StreamingConnection handler manages the web socket connection and its state. It will automatically reconnect to the server if the connection is lost. The listener will be notfied whenever the connection state changes and once every second when counting down to reconnect. The time between reconnection attempts is specified with retryEverySeconds, default is 5 seconds.

Constructors

StreamingConnectionHandler({required ServerpodClientShared client, required void listener(StreamingConnectionHandlerState state), int retryEverySeconds = 5})
Creates a new connection handler with the specified listener and interval for reconnecting to the server.

Properties

client ServerpodClientShared
The Serverpod client this StremingConnectionHandler is managing.
final
hashCode int
The hash code for this object.
no setterinherited
listener → void Function(StreamingConnectionHandlerState state)
A listener that is called whenever the state of the connection handler changes.
final
retryEverySeconds int
Time in seconds between connection attempts. Default is 5 seconds.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status StreamingConnectionHandlerState
Returns the current status of the connection.
no setter

Methods

close() → void
Disconnects the streaming connection if it is open.
connect() → void
Opens a web socket channel to the server and attempts to keep it alive.
dispose() → void
Disposes the connection handler, but does not close the connection.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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