Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR doesn't use Session on server

When I try to access the HttpContext current session from the HUB it returns null.

I tried making use of the interface IRequiresSession but it didn't work. Can someone help me?

like image 780
Danillo Corvalan Avatar asked Oct 21 '11 20:10

Danillo Corvalan


People also ask

What causes SignalR to disconnect?

If a server does not become available within the disconnect timeout period, the SignalR connection ends. In this scenario, the Closed event ( disconnected in JavaScript clients) is raised on the client but OnDisconnected is never called on the server.

How do I check if my SignalR is reconnecting?

To test reconnect after the server goes down use iisreset. To simulate client connection dropping (good luck) pull the network cable :) Pulling the network cable won't accurately simulate a client connection dropping when you're using Azure SignalR Service.


1 Answers

SignalR connections (including the connection underlying all Hub operations for a client) do not support Session state. You could enable it if you wanted to but we'd strongly recommend against it as session state access serializes requests for a given client, meaning you won't really get the benefit from SignalR duplex messaging anymore, as one request will block the other e.g. in the long polling transport, the receiving connection will block any attempt to send.

like image 86
Damian Edwards Avatar answered Sep 22 '22 05:09

Damian Edwards