Created
December 27, 2023 00:54
-
-
Save stodge/c28cd567466fdf67469d88f39aae53a4 to your computer and use it in GitHub Desktop.
Simple websocket client test
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
$(document).ready(function() { | |
const wsClient = new WebSocket("ws://localhost/ws"); | |
wsClient.onopen = function() { | |
console.debug("Connected to server"); | |
}; | |
wsClient.onclose = function(evt) { | |
console.debug("Closed: %o", evt); | |
}; | |
wsClient.onmessage = function (evt) { | |
console.debug("Rx: %o", evt.data); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment