【发布时间】:2020-05-20 18:22:52
【问题描述】:
我在 Asp.Net Core 3.1 和 Angular8 上使用 Azure SignalR。我还在客户端使用了 withAutomaticReconnect() 选项。它与 azure signalr 成功连接。但是一段时间后它会显示此错误消息并再次连接到 WebSocket。
【问题讨论】:
-
能否展示您的相关代码并告诉我们您的 Azure SignalR 服务的服务模式?
-
私有 createConnection() { let accessToken = this.authService.getAuthToken(); this.hubConnection = new HubConnectionBuilder() .withUrl(
${environment.client.signalr_endpoint}, { accessTokenFactory: () => accessToken }) .withAutomaticReconnect() .build(); this.startConnection(); this.registerEvents(); } private startConnection() { this.hubConnection.start().then(() => { console.log('SignalR Connected.'); }).catch(err => { }); } Azure SignalR 服务模式:经典
标签: azure asp.net-core-signalr azure-signalr