 connectButton.disabled = false;
          disconnectButton.disabled = true;
        };

        client.onError = (error) => {
          log(`Error: ${error.message}`, 'error');
        };

        // Connect to server
        const connected = await client.connect();
        if (!connected) {
          log('Failed to connect', 'error');
        }
      } catch (error) {
        log(`Error: ${error.message}`, 'error');
      }
    });

    // Disconnect button click handler
    disconnectButton.addEventList