Eren G.
Eren G.

Reputation: 855

How to use SignalR with multi page web app?

The SignalR user session ends after changing the page. A new session opens on the new page.

I need a connection that will continue as long as I log out of Hub.

Upvotes: 0

Views: 578

Answers (1)

Brando Zhang
Brando Zhang

Reputation: 28387

As far as I know, when you connect the signalR hub server, it will generate a connectionID.

Each new session will use specific connectionid, we couldn't modify the conenctionid when you used the new session.

If you want to let all the tab connect as one user account, you could try to check the username when the connection started and then store the username and connectionid as one to more in the server memory or else.

Then if other user send message to this user, you could get the connectionid according to the username and use Clients.Client(conid).SendAsync method to send the request.

More details about how to achieve it, you could refer to this reply.

Upvotes: 1

Related Questions