SignalR 2 connection not being persisted -
i've set sample signalr hub, chathub, added list of connections. when runs onconnected see being add list. when open page in browser (expecting list have 2 connections see 0 connections in list). chathub instantiated per request?
list<string> connections = new list<string>(); public override task onconnected() { connections.add(context.connectionid); return base.onconnected(); }
yes hub instance created each request.
you don't instantiate hub class or call methods own code on server; done signalr hubs pipeline. signalr creates new instance of hub class each time needs handle hub operation such when client connects, disconnects, or makes method call server.
Comments
Post a Comment