javascriptnode.jswebsocketws

How do I catch ping/pong frames sent to my ws listener from the server?


The ws package for nodeJS hides incoming ping frames by default and silently responds to them with pong frames.

How can I catch these incoming ping frames and take note of them?


Solution

  • You just listen for a ping event: https://github.com/websockets/ws/blob/master/doc/ws.md#event-ping

    The real answer here is RTFM.