Question

I'm trying to make a game with SignalR that can be played between two players.

I have an issue in remembering the anonymus players. At one point, the users are redirected to another page and there I'm lost.

Inspired by Mapping connections , I've been able to solve the authenticated users ( Context.User.Identity.Name ), but what should I do in order to remember the unaunthenticated users when they navigate through website? (from what I know the signalR ConnectionId changes every request).

Was it helpful?

Solution

Generate a cookie for them containing a random GUID and then use that in your connection mapping. Set the value as part of the initial HTML you send the browser. Read the value in your Hub via Context.RequestCookies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top