add method
Adds a client to the session with an optional user ID association.
The clinetID
is the unique ID of the client. The socket
is the SocketClient instance
to add. Optionally, a userID
can be provided to associate the client with a user.
Implementation
void add(String clinetID, SocketClient socket, {String? userID}) {
_clients[clinetID] = socket;
if (userID != null) {
if (!_users.containsKey(userID)) {
_users[userID] = [];
}
if (!_users[userID]!.contains(clinetID)) {
_users[userID]!.add(clinetID);
}
}
}