![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/public_html/public/ |
<!DOCTYPE html>
<html>
<head>
<title>WebSocket Test</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.log { background: #f0f0f0; padding: 10px; height: 300px; overflow-y: auto; font-family: monospace; }
button { padding: 10px; margin: 5px; }
</style>
</head>
<body>
<h1>WebSocket Connection Test</h1>
<p><strong>Current URL:</strong> <span id="currentUrl"></span></p>
<p><strong>WebSocket URL:</strong> <span id="wsUrl"></span></p>
<button onclick="testConnection()">Test Connection</button>
<button onclick="clearLog()">Clear Log</button>
<div id="log" class="log"></div>
<script>
let ws = null;
function log(message) {
const logDiv = document.getElementById('log');
logDiv.innerHTML += new Date().toLocaleTimeString() + ': ' + message + '<br>';
logDiv.scrollTop = logDiv.scrollHeight;
}
function testConnection() {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsUrl = `${protocol}//${window.location.host}/_ws`;
log(`Testing connection to: ${wsUrl}`);
if (ws) {
ws.close();
}
try {
ws = new WebSocket(wsUrl);
ws.onopen = function() {
log('✅ Connected successfully!');
};
ws.onmessage = function(event) {
log(`📨 Received: ${event.data}`);
};
ws.onerror = function(error) {
log(`❌ Error: ${error}`);
};
ws.onclose = function(event) {
log(`🔌 Closed - Code: ${event.code}, Reason: ${event.reason}`);
};
} catch (error) {
log(`❌ Failed to create WebSocket: ${error.message}`);
}
}
function clearLog() {
document.getElementById('log').innerHTML = '';
}
window.onload = function() {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsUrl = `${protocol}//${window.location.host}/_ws`;
document.getElementById('currentUrl').textContent = window.location.href;
document.getElementById('wsUrl').textContent = wsUrl;
log('Ready to test WebSocket connection');
};
</script>
</body>
</html>