Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created September 25, 2022 12:25
Show Gist options
  • Save percybolmer/15b5203aa3c3a585ec88bf9cf5c0d111 to your computer and use it in GitHub Desktop.
Save percybolmer/15b5203aa3c3a585ec88bf9cf5c0d111 to your computer and use it in GitHub Desktop.
function connectWebsocket(otp) {
// Check if the browser supports WebSocket
if (window["WebSocket"]) {
console.log("supports websockets");
// Connect to websocket using OTP as a GET parameter
conn = new WebSocket("wss://" + document.location.host + "/ws?otp="+ otp);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment