【问题标题】:How to connect and read response from microservice(TCP) in socket.io如何在 socket.io 中连接和读取来自微服务(TCP)的响应
【发布时间】:2021-08-13 20:20:29
【问题描述】:

在 Nest.js 中,我使用 tcp 架构进行微服务通信,在 socket.io 连接中,我能够连接微服务,如下所示,但我无法读取响应。

this.client.emit('getSingleRoom', payload);

this.client.send({ service: 'getSingleRoom' }, payload).toPromise();

这两个代码都与微服务连接,但是我无法读出此响应,以便我可以在主服务器中发出。我在nest.js 中使用网络套接字。

【问题讨论】:

  • 等待审核无法编辑,建议您将代码行设为代码格式。

标签: websocket tcp microservices nestjs tcpclient


【解决方案1】:

this.client.send('sendMessagesInRoom', pay).toPromise();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-27
    • 1970-01-01
    • 1970-01-01
    • 2018-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-08
    相关资源
    最近更新 更多