sendToUsers method
Send a message to multiple specific users (by user IDs). The adapter is responsible for mapping user IDs to client ID(s).
Implementation
@override
void sendToUsers(List<dynamic> userIds, String event, dynamic data) {
if (userIds.isEmpty) return;
// Deduplicate userIds and collect valid clients
final uniqueUserIds = userIds.toSet();
final clientsToSend = <SocketClient>[];
for (final userId in uniqueUserIds) {
final clientId = _userClientMap[userId];
if (clientId != null) {
final client = _clients[clientId];
if (client != null) {
clientsToSend.add(client);
}
}
}
// Send to all collected clients
for (final client in clientsToSend) {
client.send(event, data);
}
}