express - Full-duplex messaging between remote autonomous Node.js applications over WebSockets? -
There will be no human in the loop, and both endpoint autonomous nodes JS are working as independent services. Responsible for contacting endpoint via
The two endpoints will send messages independently (without human intervention), and both points will be APIs (tragic or otherwise) to receive and process messages, you can say that each endpoint is a customer , And one server, the other endpoint.
I am considering frameworks like sales.gse and loopback (apply to both end points), as well as messages on just passed JSON messages, but it is not clear what the most idiomatic approach would be.
There is a lot of web sockets overhead to connect to browsers, because of the HTTP If you are simply adding a pair of server, then a simple TCP connection will be sufficient. You can use it for this.
Now, after you have this connection, how do you start communicating? You can go through the hassle of building your own protocol, but I do not recommend it. I found that a simple RPC was the easiest. You can use more than any duplex flow (including your TCP socket).
For my own application, I have actually installed socket.io-client and let my servers use it for RPC. If I were doing it again, I would use the RPC-stream though all over the ground to leave the necessary for establishing a web socket connection.
Comments
Post a Comment