SessionsManager class

Manages WebSocket client sessions.

The SessionsManager class maintains a map of connected clients and their associated user IDs, allowing for efficient client management and communication.

Constructors

SessionsManager()

Properties

countClients int
Returns the total number of active WebSocket clients.
no setter
countUsers int
Returns the number of unique users with active sessions.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(String clinetID, SocketClient socket, {String? userID}) → void
Adds a client to the session with an optional user ID association.
clear() → void
Clears all clients and user associations from the session.
existClient(String id) bool
Checks if a client with the specified ID exists.
existUser(String userId) bool
Checks if a user with the given ID has active sessions.
getAllClients() Map<String, SocketClient>
Retrieves a map of all clients with their IDs as keys.
getClient(String id) SocketClient?
Retrieves a SocketClient instance by its ID.
getCountUserClients(String userID) int
Returns the number of clients associated with a specific user ID.
getUserClientsID(String userID) List<String>
Retrieves a list of client IDs associated with a specific user ID.
getUserClientsSocket(String userID) List<SocketClient>
Retrieves a list of SocketClient instances associated with a specific user ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String id) → void
Removes a client from the session by its ID.
toString() String
A string representation of this object.
inherited

Operators

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