I have created 2 separated application using micro services architecture with NestJs. One is the main app (port 9000), other one is the Notification service (amqp & http port 9001).
I have successfully trigger notification from main app to the Notification service using RabbitMQ (amqp).
To listen to the notification, I have separated (port 3000) front-end application (ReactJs). What I've done are:
- From React, listen directly to RabbitMq using amqp-client. I was able to receive the push notification.
- From React, listen directly to RabbitMq using StompJs over WebSocket connection. I was able to receive the push notification.
The problem is, I don't think it's okay to listen directly to the RabbitMq server.
3rd solution that I was thinking is to add WebSocket in the Notification service, and then the Front-end app (ReactJs) will listen to Notification service instead of RabbitMq directly.
What is the best practices in this case? Which one do you think is the best, 1/2/3? Or do you have other advice?
Thank you.