RealtimeClient class
Constructors
-
RealtimeClient(String endPoint, {WebSocketTransport? transport, Duration timeout = Constants.defaultTimeout, int heartbeatIntervalMs = 30000, void logger(String? kind, String? msg, dynamic data)?, RealtimeEncode? encode, RealtimeDecode? decode, TimerCalculation? reconnectAfterMs, Map<
String, String> ? headers, Map<String, dynamic> params = const {}, int longpollerTimeout = 20000, RealtimeLogLevel? logLevel, Client? httpClient}) - Initializes the Socket
Properties
- accessToken ↔ String?
-
getter/setter pair
-
channels
↔ List<
RealtimeChannel> -
getter/setter pair
- conn ↔ WebSocketChannel?
-
getter/setter pair
- connectionState → String
-
Returns the current state of the socket.
no setter
- connState ↔ SocketStates?
-
getter/setter pair
- decode ↔ RealtimeDecode
-
getter/setter pair
- encode ↔ RealtimeEncode
-
getter/setter pair
- endPoint → String
-
final
- endPointURL → String
-
Returns the URL of the websocket.
no setter
- 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
- httpClient → Client?
-
final
- isConnected → bool
-
Retuns
true
is the connection is open.no setter - logger ↔ (void Function(String? kind, String? msg, dynamic data)?)
-
getter/setter pair
- longpollerTimeout ↔ int
-
getter/setter pair
-
params
→ Map<
String, dynamic> -
final
- pendingHeartbeatRef ↔ String?
-
reference ID of the most recently sent heartbeat.
getter/setter pair
- reconnectAfterMs ↔ TimerCalculation
-
getter/setter pair
- reconnectTimer ↔ RetryTimer
-
getter/setter pair
- ref ↔ int
-
Unique reference ID for every heartbeat.
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 → WebSocketTransport
-
final
Methods
-
channel(
String topic, [RealtimeChannelConfig params = const RealtimeChannelConfig()]) → RealtimeChannel -
connect(
) → void - Connects the socket.
-
disconnect(
{int? code, String? reason}) → void -
Disconnects the socket with status
code
andreason
for the disconnect -
getChannels(
) → List< RealtimeChannel> -
leaveOpenTopic(
String topic) → void - Unsubscribe from channels with the specified topic.
-
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(
void callback(dynamic)) → void - Registers a callbacks for connection state change events.
-
onConnMessage(
String rawMessage) → void -
onError(
void callback(dynamic)) → void - Registers a callbacks for connection state change events.
-
onMessage(
void callback(dynamic)) → void - Calls a function any time a message is received.
-
onOpen(
void callback()) → void - Registers callbacks for connection state change events
-
push(
Message message) → String? - Push out a message if the socket is connected.
-
remove(
RealtimeChannel channel) → void - Removes a subscription from the socket.
-
removeAllChannels(
) → Future< List< String> > -
removeChannel(
RealtimeChannel channel) → Future< String> -
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