Skip to content

Instantly share code, notes, and snippets.

@alash3al
Created November 7, 2018 11:48
Show Gist options
  • Save alash3al/4e078a6192049c5e1bc3c38979a5b754 to your computer and use it in GitHub Desktop.
Save alash3al/4e078a6192049c5e1bc3c38979a5b754 to your computer and use it in GitHub Desktop.
Wsify connection tracking for utime
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