websocket 将多个集线器与Signal-R配合使用

lhcgjxsq  于 2022-11-24  发布在  其他
关注(0)|答案(1)|浏览(152)

我对使用signalr有点陌生。我正在处理一个系统,它将从一个服务器处理多个客户端。我想为每个客户端创建一个单独的集线器,但当我添加一个新的集线器时,另一个集线器变得不可操作。
以下是我尝试连接客户端时遇到的错误:

`[2022-11-03T15:01:03.952Z] Information: WebSocket connected to wss://localhost:7178/chatHub?id=fwNf0IydU6eYjOMPq9JQsw.
signalr.js:455 [2022-11-03T15:01:04.038Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error. InvalidOperationException: A suitable constructor for type 'Abp.AspNetCore.SignalR.Hubs.AbpHubBase' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.'.
log @ signalr.js:455
_stopConnection @ signalr.js:2709
transport.onclose @ signalr.js:2647
_close @ signalr.js:2302
stop @ signalr.js:2279
_stopInternal @ signalr.js:2445
await in _stopInternal (async)
stop @ signalr.js:2426
_stopInternal @ signalr.js:1151
_processIncomingData @ signalr.js:1386
HubConnection.connection.onreceive @ signalr.js:985
webSocket.onmessage @ signalr.js:2236`

ChatHub.cs如下所示:
public class ChatHub : AbpHubBase, ISingletonDependency
这些是我的终点

endpoints.MapHub<AbpHubBase>("/chatHub");
                endpoints.MapHub<ChatHubV>("/chatHubV2");
pgky5nke

pgky5nke1#

我想我解决了这个问题。我不需要从AbpHubBase继承。当我返回到Hub类时,我可以使用它和两个独立的端点。

相关问题