radu-matei / websocket-manager

Real-Time library for ASP .NET Core
https://radu-matei.com/blog/real-time-aspnet-core/
MIT License
452 stars 183 forks source link

how to access HttpContext etc. in the sub class inherits from WebSocketHandler? #57

Closed jcyuan closed 6 years ago

jcyuan commented 6 years ago

because the subclass inherits from WebSocketHandler will be injected as singleton, so I can't initialize some other services inside the constructor.

so how can I access to other service e.g. in the onConnected method?

jcyuan commented 6 years ago

can we modify the line in websocketmanagermiddleware.cs from: await _webSocketHandler.OnConnected(socket).ConfigureAwait(false); to this?: await _webSocketHandler.OnConnected(socket, context).ConfigureAwait(false);

jcyuan commented 6 years ago

actually I'm trying to add the exisiting ClaimsAuth to my Subclass. but don't know what exactly to do.

jcyuan commented 6 years ago

turned to SignalR so close this.