Created
July 25, 2017 21:33
-
-
Save bradurani/06960dfb8454a13675d5c7c200583c62 to your computer and use it in GitHub Desktop.
This file contains 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
var websocket = new WebSocket('ws://echo.websocket.org/'); | |
websocket.onopen = function(e) { | |
console.log('socket open'); | |
} | |
websocket.onmessage = function (e){ | |
console.log(e.data) | |
}; | |
websocket.onclose = function(e){ | |
console.log('connection closed') | |
}; | |
window.setInterval(function(){ | |
websocket.send('ping'); | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment