Search code examples
microservicesnestjsgateway

NestJS Gateway cannot receive messages from Microservices?


I'm trying to pass a message from a Microservice to an event.gateway (@WebSocketGateway()) but the @EventPattern() in the event.gateway is not receiving any message.

Basically how a Microservice can send messages to an event.gateway?

Any suggestion would be appreciated. Thanks.


Solution

  • I found a solution, maybe is not the perfect one, but solves the subject.

    in the event.gateway I add the @Controller

    ...
    @Controller('something')
    @WebSocketGateway()
    ...
    

    and then in event.module put EventsGateway to the controllers

    ...
      controllers: [EventsGateway],
      providers: [EventsGateway]
    ...
    
    

    Solved, I can receive events from microservices in the gateway.