When reconnecting after a temporary disruption, the user automatically re-joins the previously-assigned groups. Then, each time a user connects to your application, you retrieve from the repository which groups the user belongs to, and manually add that user to those groups. If you want to permanently retain information about groups and group membership, you must store that data in a repository such as a database or Azure table storage. When you add a user to a group using the Groups.Add method, the user receives messages directed to that group for the duration of the current connection, but the user's membership in that group is not persisted beyond the current connection. This helps maximize scalability, because whenever you add a node to a web farm, any state that SignalR maintains has to be propagated to the new node. SignalR sends messages to clients and groups based on a pub/sub model, and the server does not maintain lists of groups or group memberships. There is no API for getting a group membership list or a list of groups. For an introduction to using groups, see How to manage group membership from the Hub class in the Hubs API - Server Guide. In effect, a group is automatically created the first time you specify its name in a call to Groups.Add, and it is deleted when you remove the last connection from membership in it. You don't have to explicitly create groups. A group can have any number of clients, and a client can be a member of any number of groups. Groups in SignalR provide a method for broadcasting messages to specified subsets of connected clients. If you have questions that are not directly related to the tutorial, you can post them to the ASP.NET SignalR forum or. Please leave feedback on how you liked this tutorial and what we could improve in the comments at the bottom of the page. Software versions used in this topicįor information about earlier versions of SignalR, see SignalR Older Versions. This topic describes how to add users to groups and persist group membership information. This documentation isn't for the latest version of SignalR.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |