Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ws = new WebSocket("ws://localhost:8080");
ws.onopen = function(evt) {
console.log("OPEN");
}
ws.onclose = function(evt) {
console.log("CLOSE");
ws = null;
}
ws.onmessage = function(evt) {
console.log("RESPONSE: " + evt.data);
}
ws.onerror = function(evt) {
console.log("ERROR: " + evt.data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.