InMemorySocketAdapter class
Default in-memory implementation of SocketAdapter.
- Implemented types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addClient(
SocketClient client) → void -
Add a client to the adapter.
override
-
broadcast(
String event, dynamic data, {String? namespace}) → void -
Broadcast an event to all clients subscribed to that event.
override
-
broadcastToRoom(
String room, String event, dynamic data, {String? namespace}) → void -
Broadcast an event to all clients in a room.
override
-
broadcastToRoomExcept(
String room, String event, dynamic data, Set< String> excludedClientIds, {String? namespace}) → void -
Broadcast an event to all clients in a room except specific ones.
override
-
getClient(
String id) → SocketClient? -
Get a client by ID.
override
-
hasRoom(
String room) → bool -
Check if a room exists (has active clients).
override
-
hasSubscribers(
String event) → bool -
Check if an event has any subscribers.
override
-
isSubscribed(
String event, SocketClient client) → bool -
Check if a client is subscribed to an event.
override
-
join(
String room, SocketClient client) → void -
Add a client to a room.
override
-
leave(
String room, SocketClient client) → void -
Remove a client from a room.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeClient(
SocketClient client) → void -
Remove a client from the adapter.
override
-
sendToUser(
dynamic userId, String event, dynamic data) → void -
Send a message to a specific user (by user ID).
The adapter is responsible for mapping user ID to client ID(s).
override
-
sendToUsers(
List userIds, String event, dynamic data) → void -
Send a message to multiple specific users (by user IDs).
The adapter is responsible for mapping user IDs to client ID(s).
override
-
subscribe(
String event, SocketClient client) → void -
Subscribe a client to a specific event channel.
override
-
subscriberCount(
String event) → int -
Get the number of subscribers for an event.
override
-
subscriptions(
SocketClient client) → Set< String> -
Get all events a client is subscribed to.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribe(
String event, SocketClient client) → void -
Unsubscribe a client from a specific event channel.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited