Skip to content

Commit 3278154

Browse files
committed
Disconnect event added.
1 parent 9ee1d73 commit 3278154

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This example utilises a public device defined in IOStash.
4444
- `subscribeLocation(deviceId,cb())` - Subscribes to location data from the specified device.
4545
- `subscribeActions(deviceId,cb())` - Subscribes to device trigger action of the specified device.
4646
- `subscribeCustomData(deviceId,cb())` - Subscribes to custom data sent to the device.
47+
- `onDisconnect(cb())` - Fires when the connection to the server is lost.
4748

4849
**Notes**
4950

iostash.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7403,6 +7403,12 @@ iostash = function () {
74037403
})
74047404
}
74057405

7406+
onDisconnect = function(callbacl) {
7407+
socket.on('disconnect',function(){
7408+
callback()
7409+
})
7410+
}
7411+
74067412
return {
74077413
'init': init,
74087414
'initPublic': initPublic,
@@ -7414,7 +7420,9 @@ iostash = function () {
74147420
'unSubscribeDataPoint': unSubscribeDataPoint,
74157421
'subscribeActions': subscribeActions,
74167422
'subscribeCustomData': subscribeCustomData,
7417-
'subscribeLocation': subscribeLocation
7423+
'subscribeLocation': subscribeLocation,
7424+
'onDisconnect': onDisconnect
7425+
74187426
}
74197427

74207428
}()

0 commit comments

Comments
 (0)