typescript - Hubconnection.Invoke 需要几秒钟才能到达服务器
问题描述
我有一个客户端到服务器方法调用的问题,需要几秒钟才能到达服务器。代码很简单:
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"
}
这是可能发生的事情吗?
解决方案
推荐阅读
- node.js - ngrok 回调 URL 验证失败
- python - 更改回收视图列宽
- javascript - 如何使用单色元素的动画背景
- python - 在 Python 中查找字符串中的确切子字符串
- excel - 使用非活动工作表的 Vba 组合框
- c# - 带有 MVVM 绑定的 JQuery Kendo UI Grid 上重新排序的列的状态持久性
- javascript - 将字符串格式的 html 元素附加到元素中在元素周围添加双引号
- wpf - 如果传递长消息,则根本不显示 WPF MessageBox
- mongodb - BSON`_id`与字符串`id`的MongoDB索引策略?
- chef-infra - 在 Solaris 上安装 chef-dk & Inspec