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

    Puck.connect(function(connection) { 
    	connection.on("data", function(d) { 
    		// handle receiving data 
    	} 
    	connection.write("reset();\n", function() { 
    		setTimeout(function(){ 
    			// do various stuff here 
    			// reset on disconnect 
    			connection.write("NRF.on('disconnect',fu­nction(){ reset(); });\n",function(){}); 
    		},1500); 
    	}); 
    	// I'm hoping there's a way to detect disconnection here 
    	// e.g. connection.on("disconnect", function(){}); 
    }); 
    

    Thanks!

About