Skip to content

Instantly share code, notes, and snippets.

@stodge
Created December 27, 2023 00:54
Show Gist options
  • Save stodge/c28cd567466fdf67469d88f39aae53a4 to your computer and use it in GitHub Desktop.
Save stodge/c28cd567466fdf67469d88f39aae53a4 to your computer and use it in GitHub Desktop.
Simple websocket client test
$(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