RealtimeClient class

Constructors

RealtimeClient(String endPoint, {WebSocketChannel transport(String url, Map<String, String> headers)?, void encode(dynamic payload, void callback(String result))?, void decode(String payload, void callback(dynamic result))?, Duration timeout = Constants.defaultTimeout, int heartbeatIntervalMs = 30000, int longpollerTimeout = 20000, TimerCalculation? reconnectAfterMs, void logger(String? kind, String? msg, dynamic data)?, Map<String, String> params = const {}, Map<String, String>? headers})
Initializes the Socket

Properties

accessToken String?
getter/setter pair
channels List<RealtimeSubscription>
getter/setter pair
conn ↔ WebSocketChannel?
getter/setter pair
connState ↔ SocketStates?
getter/setter pair
decode ↔ void Function(String payload, void callback(dynamic result))
getter/setter pair
encode ↔ void Function(dynamic payload, void callback(String result))
getter/setter pair
endPoint String
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
final
heartbeatIntervalMs int
getter/setter pair
heartbeatTimer Timer?
getter/setter pair
logger ↔ (void Function(String? kind, String? msg, dynamic data)?)
getter/setter pair
longpollerTimeout int
getter/setter pair
params Map<String, String>
final
pendingHeartbeatRef String?
getter/setter pair
reconnectAfterMs ↔ TimerCalculation
getter/setter pair
reconnectTimer ↔ RetryTimer
getter/setter pair
ref int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendBuffer List
getter/setter pair
stateChangeCallbacks Map<String, List<Function>>
getter/setter pair
timeout Duration
final
transport → WebSocketChannel Function(String url, Map<String, String> headers)
final

Methods

channel(String topic, {Map<String, dynamic> chanParams = const {}}) RealtimeSubscription
connect() → void
Connects the socket.
connectionState() String
Returns the current state of the socket.
disconnect({Function? callback, int? code, String? reason}) → void
Disconnects the socket with status code and reason for the disconnect
endPointURL() String
Returns the URL of the websocket.
isConnected() bool
Retuns true is the connection is open.
log([String? kind, String? msg, dynamic data]) → void
Logs the message. Override this.logger for specialized logging.
makeRef() String
Return the next message ref, accounting for overflows
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClose(dynamic callback(dynamic)) → void
Registers a callbacks for connection state change events.
onConnMessage(String rawMessage) → void
onError(dynamic callback(dynamic)) → void
Registers a callbacks for connection state change events.
onMessage(dynamic callback(dynamic)) → void
Calls a function any time a message is received.
onOpen(Function callback) → void
Registers callbacks for connection state change events
push(Message message) → void
remove(RealtimeSubscription channel) → void
Removes a subscription from the socket.
sendHeartbeat() → void
setAuth(String? token) → void
Sets the JWT access token used for channel subscription authorization and Realtime RLS.
toString() String
A string representation of this object.
inherited

Operators

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