20 lines
399 B
PHP
20 lines
399 B
PHP
|
|
<html><head><title>WebSocket</title>
|
||
|
|
|
||
|
|
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="root"></div>
|
||
|
|
<script>
|
||
|
|
|
||
|
|
let socket = new WebSocket('wss://mojo.bateworld.com');
|
||
|
|
|
||
|
|
socket.onopen = () => console.log('Connected');
|
||
|
|
socket.onmessage = e => console.log('Received:', e.data);
|
||
|
|
socket.onclose = () => console.log('Disconnected');
|
||
|
|
socket.onerror = e => console.error('Error:', e);
|
||
|
|
|
||
|
|
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|