WebSocket Ping/Pong

109 views
Skip to first unread message

Martin Konecny

unread,
Aug 29, 2015, 3:08:40 PM8/29/15
to nginxpushstream
Hi,

I'm trying to implement a system where the client WebSocket sends a ping, and receives a pong. This wasn't working so I took a look through the source code. It appears the module supports only sending pings, and not responding to a ping with a pong.

I also noticed that if the client sends a message after enabling "push_stream_websocket_allow_publish", then the module will send back two messages after the client writes to it: an echo of the original message as well as a ping.

I'm thinking of implementing a PING/PING  echo system simply by keeping "push_stream_websocket_allow_publish" enabled and writing messages from the client, and waiting for the module to echo it back.

Are there any caveats or side-effects I should be wary about by enabling "push_stream_websocket_allow_publish" ? Can this be abused by clients for other purposes than an echo?

Martin Konecny

unread,
Aug 29, 2015, 10:14:12 PM8/29/15
to nginxpushstream
It looks like I misinterpreted the purpose of "push_stream_websocket_allow_publish", as it looks like it will publish to other websockets users as well.

Would be nice to have PONG response have a PING from the client as I believe the client is usually the receiver, and it's difficult for the client to know whether the connection is still active if the client doesn't send anything.

Wandenberg Peixoto

unread,
Aug 30, 2015, 7:46:08 PM8/30/15
to nginxpu...@googlegroups.com
Hi Martin,

can you give a try to websocket_improvments branch.
It already implement the PONG response to a PING message, and other things.

Kind regards,
Wandenberg

--
You received this message because you are subscribed to the Google Groups "nginxpushstream" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginxpushstre...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages