1

I've run into a situation where I need multiple SignalR hubs (at least 2) with different configurations.

Currently with v1.1.0 I can only do things like the following which configures all hubs:

GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(30);

Is it possible to set different configurations for multiple hubs?

kzfabi
  • 2,065
  • 1
  • 22
  • 26

1 Answers1

5

All hubs share the same connection object therefore they all share the same configuration.

If you want to have 1 server but multiple connection configurations for hubs you can do the following:

app.MapHubs(yourPathToConnectionWithConfigurationA, new HubConfiguration
{
    Resolver = MyResolverWithConfigurationA
});

app.MapHubs(yourPathToConnectionWithConfigurationB, new HubConfiguration
{
    Resolver = MyResolverWithConfigurationB
});

Therefore when you want to use configuration A you connect to that server end point and when you want to connect to endpoint B you connect to that endpoint. Keep in mind the hubs will not share clients/connections across the two configurations even though the hubs will be on both.

N. Taylor Mullen
  • 18,061
  • 6
  • 49
  • 72
  • I'll see if I can try to use this approach and come back with the results. Thanks for your answer. – kzfabi Jul 15 '13 at 14:09