use of com.corundumstudio.socketio.store.pubsub.DispatchMessage in project netty-socketio by mrniko.
the class BroadcastOperations method dispatch.
private void dispatch(Packet packet) {
Map<String, Set<String>> namespaceRooms = new HashMap<String, Set<String>>();
for (SocketIOClient socketIOClient : clients) {
Namespace namespace = (Namespace) socketIOClient.getNamespace();
Set<String> rooms = namespace.getRooms(socketIOClient);
Set<String> roomsList = namespaceRooms.get(namespace.getName());
if (roomsList == null) {
roomsList = new HashSet<String>();
namespaceRooms.put(namespace.getName(), roomsList);
}
roomsList.addAll(rooms);
}
for (Entry<String, Set<String>> entry : namespaceRooms.entrySet()) {
for (String room : entry.getValue()) {
storeFactory.pubSubStore().publish(PubSubType.DISPATCH, new DispatchMessage(room, packet, entry.getKey()));
}
}
}
Aggregations