node.js - NodeJS with Einaros WebSocket : Client Ping Server VS Server Ping Client -


i developing websocket service using nodejs , einaros ws module , have raised question: nodejs einaros ws connection timeout apparently no 1 know answer presume should write own ping pong based system check whether client still connected or not.

i not sure whether should write code on server side or client side; mean if server should ping client or... client (which own websocket application) should ping server.

is there difference between both methods ?

it called heartbeat , sent client every 5 seconds ping frame (0x09) opcode while server responds pong frame (0xa) opcode.

in theory doesn't matter whether it's server or client initiating heartbeat, in real-world situation better client keep updated whether server there or not able inform user possible.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -