How to get the AspNet Core SignalR Transport Protocol in the Hub?

人盡茶涼 提交于 2019-12-11 06:16:41

问题


In the old SignalR, you could do this to get the transport in the Hub on the Server:

Context.QueryString["transport"];

But in the new SignalR, written for AspNet Core, I couldn't find where the Transport Protocol can be found within the Hub on the Server. Can it be found? If so, where?


回答1:


As of ASP.NET Core SignalR 1.0.0-rc1-final (commit), you can get the TransportType from:

// using Microsoft.AspNetCore.Http.Connections.Features;

var transportType = Context.Features.Get<IHttpTransportFeature>().TransportType;


来源:https://stackoverflow.com/questions/53547939/how-to-get-the-aspnet-core-signalr-transport-protocol-in-the-hub

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!