how can I send message to specific user in specific group using asp.net signalR

淺唱寂寞╮ 提交于 2021-01-24 09:30:51

问题


I can send message to all group in chat

 return context.Clients.Group(sGrp).recieveNotification(message, user, chatid, uuid);

I can send message to all group in chat

return context.Clients.User(currentuser).seenyou(myname);

the problem when i send message to specific user in specific group is there is way to do this .


回答1:


The only way to send a message to a specific user is by addressing the user by its connection Id. In this case it doesn't matter if he is in a specific group or not. Other than that there's no such thing as a built-in list, that you can iterate on, you need to manage those references by yourself.

Of course, if the desired user is the sender, you can use Clients.Caller.



来源:https://stackoverflow.com/questions/34381104/how-can-i-send-message-to-specific-user-in-specific-group-using-asp-net-signalr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!