( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<!DOCTYPE html>
<html>
<body>
<h1>WebSocket Test</h1>
<div id="status">Disconnected</div>
<button onclick="testConnection()">Connect</button>
<script>
let ws;
function testConnection() {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const hostname = window.location.hostname;
const url = protocol + '//' + hostname + ':8080';
ws = new WebSocket(url);
ws.onopen = () => {
document.getElementById('status').textContent = 'Connected';
ws.send(JSON.stringify({
type: 'join',
user_id: 'test_user',
themeid: 1,
page_id: 0
}));
};
ws.onmessage = (event) => {
console.log('Received:', event.data);
};
}
</script>
</body>
</html>