When implementing web push service from node.js to socket.io

Asked 2 years ago, Updated 2 years ago, 87 views

Hello, everyone

Node.js wants to use socket.io to implement real-time push services on the web.

There is a push server and a web server separately, but I want to push to the push server when I write a post on the web server.

The way I thought about it is When the act page of the web server (handling save posts, etc.) is called, Create a page that functions to send a push message by connecting a separate socket to the web server When the act page is called, I want to send a push message by simply calling the file instead of showing it using curl, etc. on the server.

In this way (socket connection > Push message request > socket termination) was instantaneously connectedgo Is it normal to send a message to the server and exit immediately? Or is there another common way? It's obvious on the web, but I wonder if this is the norm on the socket.

node.js javascript push socket.io

2022-09-22 22:03

1 Answers

In a typical configuration, a message queue (such as Rabbit MQ) is used to subscribe to the queue on the push server side, and an event is issued as a message queue on a web server that handles events that have occurred.

If the size of the message is small and it is not very important whether the message is delivered or not, it is not too much to implement it by calling it by rpc.


2022-09-22 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.