SignalR - 如何禁用 WebSockets(但保持其他传输活动)?

SignalR - how to disable WebSockets (but keep other transports active)?

在 C# 客户端和 Web 客户端中 - 我如何告诉 signalR - "Try everything but websockets"?

我的网络代码中有以下内容:

 window.hubReady = $.connection.hub.start({ transport: 'longPolling' });

但这只是 javascript 和长轮询;我正在寻找 JS 和 C# 客户端的配置,以仅删除 websockets 作为传输。如何做到这一点?

在服务器上:

 public class Startup    
 {
     public void Configuration(IAppBuilder app)
     {
         DisableWebSockets(GlobalHost.DependencyResolver);

         HubConfiguration hubConfiguration = new HubConfiguration();
         hubConfiguration.EnableDetailedErrors = true;
         app.MapSignalR(hubConfiguration);
     }

     public static void DisableWebSockets(IDependencyResolver resolver)
     {
         var manager = resolver.Resolve<ITransportManager() as TransportManager;
         manager.Remove("webSockets");
     }
 }

在客户端:

$.connection.hub.start({ transport: ['serverSentEvents', 'foreverFrame', 'longPolling'] }).done(function () {...}

编辑 - 添加括号