2021-01-26 12:04:53 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Wormhole test</title>
|
|
|
|
|
|
|
|
<script>
|
2021-02-04 16:01:14 +02:00
|
|
|
let theFunniestStringEver = '';
|
2021-02-27 01:56:46 +02:00
|
|
|
for (let i = 0; i < 100000; i++) {
|
2021-02-04 16:01:14 +02:00
|
|
|
theFunniestStringEver += 'h';
|
|
|
|
}
|
|
|
|
|
2021-01-26 12:04:53 +02:00
|
|
|
// Create WebSocket connection.
|
|
|
|
const socket = new WebSocket('ws://localhost:8080/hello');
|
|
|
|
|
|
|
|
// Connection opened
|
|
|
|
socket.addEventListener('open', function (event) {
|
2021-02-04 16:01:14 +02:00
|
|
|
socket.send(theFunniestStringEver);
|
2021-01-26 12:04:53 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
socket.addEventListener('error', console.error)
|
|
|
|
|
|
|
|
// Listen for messages
|
|
|
|
socket.addEventListener('message', function (event) {
|
|
|
|
console.log('Message from server ', event.data);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|