Hi all, the title pretty much says it all!
Under the MVC framework for most websocket events I have found so far the callbacks are all passed (data, socket)
{ "event": "connect", "callback": "socketcontroller#sockit"} . . . sockit = function(data,socket){ //stuff };What is passed on a disconnect event?
The biggest issue is that there are TWO disconnect scenarios - intentional... and accidental! It is mostly the accidental scenario I am concerned about.
I am guessing an intentional disconnect is handled in the normal way.
What is passed to the callback after an accidental disconnection (eg client loses signal)
Many thanks in advance,
Robin
PS - Sorry, I've cross posted this with the Appcelerator Q&A, I'm just trying to get AN answer from anyone who knows! Cheers!
Hi all! Okay, I've worked this out...
{ "event": "disconnect", "callback": "socketcontroller#disconnect" }DOES get called and passes both 'data' AND 'socket' as usual...
From what I can gather, data
is a string containing the reason for disconnection.
I've only found 2 values so far:
- "booted" (when calling socket.disconnect();
from the client)
and
- "heartbeat timeout" when the client is closed without specifically sending a disconnect instruction. It also seems to take about 30 seconds for the timeout, so you may need to bear that in mind.