Hubconnection.Invoke需要几秒钟才能到达服务器

时间:2020-07-10 09:00:01

标签: typescript asp.net-core-signalr

我对客户端到服务器的方法有问题,方法调用需要花费几秒钟才能到达服务器。 代码很简单:

    this.hubConnection.invoke('OnPendingAlertBadgeCompanyChange', companyId, email)
      .then(_ => {
        Logging.logWithTimestamp(`::: SignalRService => invokeHubForGettingDataForBadgePendingAlerts has been fired. Waiting for data ...`);
        this.gettingDataForBadgePendingAlertsPendingCall = true;
      })
      .catch(reason => {
        this.trowSignalRError(reason)
      }); 

给我的印象是连接可能很忙,通话将在空闲时进行。

hubConnectionState无法判断它是否空闲:

export declare enum HubConnectionState {
    /** The hub connection is disconnected. */
    Disconnected = "Disconnected",
    /** The hub connection is connecting. */
    Connecting = "Connecting",
    /** The hub connection is connected. */
    Connected = "Connected",
    /** The hub connection is disconnecting. */
    Disconnecting = "Disconnecting",
    /** The hub connection is reconnecting. */
    Reconnecting = "Reconnecting"
}

这有可能发生吗?

0 个答案:

没有答案