MCPcopy Create free account
hub / github.com/socketstream/socketstream / sendToMultiple

Function sendToMultiple

lib/websocket/event_dispatcher.js:42–56  ·  view source on GitHub ↗
(send, msg, destinations, type)

Source from the content-addressed store, hash-verified

40
41// Attempt to send the event to the socket. If socket no longer exists, remove it from set
42function sendToMultiple(send, msg, destinations, type) {
43 destinations = destinations instanceof Array && destinations || [destinations];
44 destinations.forEach(function(destination) {
45 var set, socketIds;
46 set = subscriptions[type];
47 if ((socketIds = set.members(destination))) {
48 return socketIds.slice(0).forEach(function(socketId) {
49 if (!send.socketId(socketId, msg, destination)) {
50 return set.removeFromAll(socketId);
51 }
52 });
53 }
54 });
55 return true;
56}

Callers 1

andThenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected