SignalR - sending to a number of clients (not a group) -


i'm using signalr in prototype i'm building. need broadcast messages number of clients, there logic clients message complex enough rule out using groups. instead, i'm checking each connected client - if applicable, they're added list<>. send message using:

var clients = determineclients(msg); foreach (var client in clients)     client.send(msg); 

of course, if able use groups, do...:

var group = determinegroup(msg); group.send(msg); 

... since 'send' method of group appears same thing - enumerate clients in group , call 'send' on those. 'correct' way this? or there way create temporary group on fly? 'dynamic' type of group or singular client makes difficult me determine whether i'm doing right. if there magic going on behind scene optimising broadcast number of clients, i'd rather use that!

any advice appreciated. let me know if need more info.

if you're trying send same message number of different clients based on complex criteria best bet have group contains of clients , query find out clients do not fit criteria. list of connection ids not fit criteria can do:

clients.group("mygroupthathasallmyclients",myexcludedconnectionids).bar(); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -