Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are group subscriptions automatically handled on Reconnect?

Tags:

signalr

I have a chat room using SignalR Hub for its messaging. Occasionally I get reports from users where it 'freezes'. Now this can be interpreted as no messages are coming through, I suspect as they have been dropped from a group.

My question is, does the connection get re-subscribed back into its groups automatically, or do you have to do something yourself in the Reconnect method:

public Task Reconnect(IEnumerable<string> groups)
{
        return Clients.rejoined(Context.ConnectionId, DateTime.Now.ToString());
}
like image 970
gavins Avatar asked Nov 09 '12 07:11

gavins


1 Answers

Yes, in 1.0.0.0-alpha1 you can enable auto rejoining of groups by using the new AutoRejoiningGroupsModule pipeline module using the EnableAutoRejoiningGroups extension method for the hub pipeline you build. This feature was not available in previous versions of the framework.

So you would end up with this somewhere in your startup code:

GlobalHost.HubPipeline.EnableAutoRejoiningGroups();

UPDATE:

Please note that the final version of SignalR 1.0 made auto-rejoining of groups the default behavior and so EnableAutoRejoiningGroups was removed. You can see this answer for more details.

like image 51
Drew Marsh Avatar answered Sep 27 '22 17:09

Drew Marsh