disconnect detection

272 views
Skip to first unread message

DaveM

unread,
Mar 2, 2011, 4:54:11 AM3/2/11
to Faye users
firstly: amazing framework, have been evaluating a number of
frameworks to replace homegrown comet solution, and Faye seems to be
the winner (especially over socket.io).

My question is this: is it possible to detect client disconnections?

James Coglan

unread,
Mar 2, 2011, 5:20:23 AM3/2/11
to Faye users
On Mar 2, 9:54 am, DaveM <dmos...@gmail.com> wrote:
> My question is this: is it possible to detect client disconnections?

I've answered this before: http://groups.google.com/group/faye-users/msg/a34ffa19bc2611f2

Though I'm coming round to the idea of adding more monitoring, I think
you should consider very carefully whether to couple Faye to your
application logic, or whether you should implement your own timeout
strategy. Personally I've always gone with implementing my own on each
project, and the concept of a 'user disconnection' does vary from
project to project.

DaveM

unread,
Mar 2, 2011, 1:28:28 PM3/2/11
to Faye users
Fair enough: client heartbeat pings + detecting page unload

James Coglan

unread,
Mar 2, 2011, 1:39:35 PM3/2/11
to Faye users
On Mar 2, 6:28 pm, DaveM <dmos...@gmail.com> wrote:
> Fair enough: client heartbeat pings + detecting page unload

That's basically what Faye does: /meta/connect messages are treated as
pings by the server, which is why they're needed even when using a
persistent connection like a WebSocket. It also uses page unload to
trigger a disconnect, though I find that the JS runtime often dies
before the message is sent.

Matt

unread,
Mar 3, 2011, 4:44:27 AM3/3/11
to Faye users
That's right. But with Websockets server can detect when connection
was dropped and it could trigger some event like clientId
disconnected.
Maybe adding some timeout (few sec. max).

With other transports it could be achieved with longer timeout (but
again reasonably small max 10 sec.) and this is not related to /meta/
connect.
So for example I have a timeout 60 sec and long-polling connection
drops at 30 sec... client tries to reconnect and if it's not
successful in 10 sec server reports timeout.

DaveM

unread,
Jul 11, 2011, 3:36:20 AM7/11/11
to faye-...@googlegroups.com

Hmm, am looking at this again. 

I want to be able to publish a message before the page is unloaded.

Problem seems to be that client.publish doesn't work.

Presumably Faye is catching onunload first and disconnecting.

Is there a way to hook into the onunload method?

Dave


Reply all
Reply to author
Forward
0 new messages