blob: ab4f857d5d198dffb145afdf6c124554af0dc3cc [file] [log] [blame]
<!DOCTYPE html>
<body>
<script>
function shouldSendInfiniteMessages() {
const url = new URL(document.location);
return !!url.searchParams.get('infiniteMessages');
}
const protocol = location.protocol.replace('http', 'ws');
const url = protocol + '//' + location.host + '/'
const ws = new WebSocket(url);
ws.onopen = () => {
if (shouldSendInfiniteMessages()) {
setInterval(() => {
ws.send('ping');
}, 100);
} else {
ws.send('ping');
}
}
ws.onmessage = (msg) => {
if (msg.data == 'ping') ws.send('pong')
};
</script>
</body>