C#WebSocket消息回调

C#WebSocket消息回调,c#,socket.io,C#,Socket.io,我来自NodeJS和Angular的世界。我使用WebSocket库Socket.io在那里我可以使用ackSocket.send([…args][,ack])作为回调函数来获得直接响应 我想知道的是一种以类似方式实现回调的方法,或者我可以在C#中使用的另一种回调协议。 例如: - the client sends an action to be executed in a service (C#) threw socket message. - the service then execute

我来自
NodeJS
Angular
的世界。我使用WebSocket库
Socket.io
在那里我可以使用
ack
Socket.send([…args][,ack])
作为回调函数来获得直接响应

我想知道的是一种以类似方式实现回调的方法,或者我可以在C#中使用的另一种回调协议。

例如:

- the client sends an action to be executed in a service (C#) threw socket message.
- the service then executes the action and after X seconds has a response.
- The response should return to the same place where the client sent the request.
这类似于API协议,这就是为什么回调函数对我如此方便的原因。 我不能在这个项目中使用API协议。

我强烈推荐使用微软开发的,但它是原生的,超级简单的,而不是集成的套接字。io

我强烈推荐使用微软开发的,但它是原生的,超级简单的,而不是集成的套接字。io

最后,我发现NuGet的工作原理非常棒。尤其是
Emit with Ack
部分。

最后,我发现NuGet的工作原理令人惊叹。尤其是
Emit with Ack
部分