NodeJS with Einaros WebSocket: Ping VS Server Ping Client

I am developing a WebSocket service using NodeJS and the Einaros WS module, and I asked this question: NodeJS Einaros WS Time Time Time, which apparently no one knows the answer, so I assume that I have to write my own ping-pong based system to check, the client is still connected.

I am not sure whether to write code on the server side or on the client side; I mean, if the server should ping the client or ... the client (which is my own application for web applications) should ping the server.

Is there a difference between the two methods?

0
websocket
source share
1 answer

It is called a pulse and is usually sent by the client every 5 seconds with a ping frame ( 0x09 ) as an operation code, while the server responds with a frame with pongs ( 0xA ) as an operation code.

In theory, it doesn’t really matter if it is a server or a heart-triggering client, but in a real situation it is usually better that the client is constantly updated regardless of whether the server exists or not, to report as quickly as possible.

+4
source share

All Articles