dotnet / dotnet/AspNetCore.Docs

Topic Rewrite/Update: Mapping SignalR Users to Connections

Open
#28,410 1 comment 0 reactions 1 assignee Claimed by @wadepickett View on GitHub
Pri1 SignalR
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

Create a new .NET Core topic following the general outline of this 4.x Framework topic (from 2014): [Mapping SignalR Users to Connections](https://learn.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/mapping-users-to-connections)

For review I would like rethink this as a new topic, rather than a port update of the 4.x topic as is.

Why this topic is needed:

- We do not currently provide a clear central list of the options and when to use them ASP.NET Core SignalR. There are some portions of that story available in up-to-date topics that can be pointed to for more detail however such as Managing users and groups and storing in Azure Tables.
- Customers are referring to the extremely outdated 4.x Framework topic (from 2014) which is not usable for ASP.NET Core SignalR.
- Customers turning to stackoverflow and other sources for help have demonstrated confusion over the workflow pattern and options available for mapping SignalR users to connections in ASP.NET Core.

Draft outline for review and any suggestions are very welcome:

- Introduction
- Overview of options.
- Table clarifying when to use each approach.
- Pass the connection ID between clients.
- A singleton service
- Overview and then link to [Inject services into a hub](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-7.0#inject-services-into-a-hub) Use this xref: (xref:signalr/hubs#inject-services-into-a-hub)
- In-memory storage
- Introduction
- Code examples
- Single and multiple user groups
- Introduction
- Code examples
- Point to [Manage users and groups in SignalR: Groups in SignalR](https://learn.microsoft.com/en-us/aspnet/core/signalr/groups?view=aspnetcore-7.0#groups-in-signalr) for more info.
- Permanant, external storage:
- Database
- Azure table storage

When the topic is published, remember to link to it from other SignalR topics that refer mapping and retaining SignalR connection ID's and related user information.
For example: [Send messages from outside a hub: Get an instance of IHubContext in middleware](https://review.learn.microsoft.com/en-us/aspnet/core/signalr/hubcontext?view=aspnetcore-8.0&branch=pr-en-us-28343#get-an-instance-of-ihubcontext-in-middleware)

See related PR #28343

Reminder: The original doc has a lot of "you" and "your" in there to remove
Example, this:
"If your application needs to map a user to the connection ID and persist that mapping, you can do one of the following:"
...would change to this:
Apps that need to map a user to the connection ID and persist that mapping can do one of the following:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.