如何从Postman调用SignalR事件?

9lowa7mx  于 5个月前  发布在  Postman
关注(0)|答案(1)|浏览(62)

我想从Postman调用SignalR事件,我也经历了this问题,但它对我没有帮助。
它给出了下面的错误,在这个例子中,由于安全原因,我提到了URL为myUrl。


的数据
下面是C#代码。

private HubConnection hub connection;
private IHubProxy hubProxy;

hubConnection = new HubConnection(myUrl, useDefaultUrl: false);
hubConnection.TransportConnectTimeout = new TimeSpan(10000);
hubConnection.Credentials = CredentialCache.DefaultCredentials;
hubConnection.Closed += _hubConnection_Closed;
hubConnection.Error += _hubConnection_Error;

hubProxy = hubConnection.CreateHubProxy(myHubName);
hubProxy.On<CurrencyPair>("getItems", value =>
{
    DoSomething(value);
}

字符串

Postman版本9.31.9

iqih9akk

iqih9akk1#

如果您正在使用可通过ASP.NET应用程序访问的SignalR服务进行本地调试,则它应该使用URL:

  • wss://localhost:sslport/myHub(使用SSL)
  • ws://localhost:port/myHub(无SSL)

其中,myHub 是用于在routes.MapHub中Map服务器端Hub的名称。

相关问题