21 lines
474 B
HTML
21 lines
474 B
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="de" dir="ltr">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title></title>
|
||
|
</head>
|
||
|
<body>
|
||
|
Hello World
|
||
|
<script type="text/javascript">
|
||
|
const host = location.origin.replace(/^http/, 'ws')
|
||
|
const ws = new WebSocket(host)
|
||
|
ws.onmessage = msg => console.log(msg.data)
|
||
|
|
||
|
ws.onopen = () => {
|
||
|
console.log('Hai')
|
||
|
ws.send('Ping') // Send the message 'Ping' to the server
|
||
|
}
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|