Skip to content

Instantly share code, notes, and snippets.

View sesgoe's full-sized avatar

Ses Goe sesgoe

View GitHub Profile
@sesgoe
sesgoe / 01_scripts_and_styles.js
Last active May 30, 2024 09:26
Retool Realtime WebSocket
const webSocket = new WebSocket('wss://echo.websocket.org');
//Event listeners are the pillars upon which WebSockets are built. This event fires when the WebSocket is considered 'OPEN',
//which means that it has connected successfully.
webSocket.addEventListener('open', function(event) {
console.log('websocket connected successfully') //log this into the browser console so we can check if the websocket connected
});
//This is a global reference to the websocket that we created. We need this because otherwise multiple JS