-
• #2
Looking at the libray I think
connection.on('close', function() { ... });
would do it... -
• #3
Thanks, that seems to do the job!
Might be worth noting, though, that it doesn't appear to work every time - sometimes the connection can drop out, and no close event is fired. When this happens, the "Disconnected (gattserverdisconnected)" log does not appear in the console from puck.js either. -
• #4
Ok, thanks - does any other message about disconnection appear that might mean the library is at all aware the connection has dropped out? You can set
Puck.debug=3;
to help with extra logging info.
If a puck disconnects from my browser due to the connection dropping out (e.g. it moves out of range) is there a way to detect this on the web front end? I can see that puck.js creates the following console log:
Disconnected (gattserverdisconnected)
I’m using the following code snippet to create a 2-way connection as per one of your site tutorials. This includes the part about resetting the puck on disconnection, which seems to work fine on the puck - I just want to be able to reset the browser too.
Thanks!