interface SocketState { connection: WebSocket | null; auth: boolean; } // Create WebSocket connection. const socket = new WebSocket('ws://localhost:8080'); // Connection opened socket.onopen = function (event) { socket.send('Hello Server!'); } socket.onmessage = function(event) { console.debug("WebSocket message received:", event); }