run script on client connect/disconnect

79 views
Skip to first unread message

András Kardos

unread,
May 10, 2016, 4:20:32 PM5/10/16
to nginxpushstream
Is there a way to run a script on the server or call an URL when a client opens or closes a channel? I'd use that to update a live display of active users - of course through server push - on an admin display. Are disconncects actually detectable by the server immediately?

Thanks!

Wandenberg Peixoto

unread,
May 10, 2016, 8:47:47 PM5/10/16
to nginxpu...@googlegroups.com
Hi András,

currently the closest option you have to this is to use the "events channel" .
You can subscribe to this channel with a script on your server, listening when a channel is created/destroyed and when someone subscribe/leave the channel and than execute the operations you need to update your live display.

To detect that some client disconnect the module take some time, specially under SSL connections.
On non SSL connections the nginx do a "peak" in the socket and if it fail it reports the user has gone.
Under SSL this peak isn't done.
In either cases the only way to be sure that a user has gone is try to write to the socket and receive an error.
So, set a ping message with a small interval is a good idea to decrease the time needed to detect that the user has gone.

I hope this can help in your project.


On Tue, May 10, 2016 at 5:20 PM, András Kardos <k.an...@gmail.com> wrote:
Is there a way to run a script on the server or call an URL when a client opens or closes a channel? I'd use that to update a live display of active users - of course through server push - on an admin display. Are disconncects actually detectable by the server immediately?

Thanks!

--
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.

András Kardos

unread,
May 11, 2016, 12:34:39 PM5/11/16
to nginxpushstream
Hi Wanden, thanks, this is what I needed to know.
Reply all
Reply to author
Forward
0 new messages