Created
November 7, 2018 11:48
-
-
Save alash3al/4e078a6192049c5e1bc3c38979a5b754 to your computer and use it in GitHub Desktop.
Wsify connection tracking for utime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wsifyTrackDisconnect(opts){ | |
url = opts.url || "wss://wsify-utime.uflare.io/subscribe" | |
key = opts.key || (function(){ | |
throw new Error("You didn't specify the user key {key: ''}"); | |
})() | |
ws = new WebSocket(url + "?key="+key) | |
ws.onclose = function(){ | |
alert("Please note that any currently running task has been pused due to network interruption, please refresh the page when network connection resumed") | |
} | |
ws.onopen = function(){ | |
console.log("wsify-tracker has been connected") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment