c# - Mapping SignalR Users to Connections in Groups -


how can add/remove user group using userid

groups.add(userid,"groupname") 

that use in database instead of using connectionid

groups.add(connectionid,"groupname") 

i created mapping here! using user id provider method , able this

clients.users(userid).sendmessage("asa") 

but

groups.add(userid,"groupname") 

it not working. how can make groups.add(userid,"groupname") work? there special mapping don't know or using 1 wrong?

it not possible add userid group. should use connectionid. depending of needs can use 1 of approaches described in the link provided.

for example, can add each connection group named userid:

groups.add(context.connectionid, userid); 

and can send messages specified user:

clients.group(userid).sendmessage("asa"); 

another use case may include determining userid in onconnected method , adding user needed group connectionid:

var groupname = getgroupnamebyuserid(userid); groups.add(context.connectionid, groupname); ... clients.group(groupname).sendmessage("asa"); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -