2020-04-09 10:19:11 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Buzzer</title>
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta name="description" content="A cool thing made with Glitch">
|
|
|
|
<link id="favicon" rel="icon" href="https://glitch.com/edit/favicon-app.ico" type="image/x-icon">
|
|
|
|
<link rel="stylesheet" href="/style.css">
|
|
|
|
<script src="/script.js" defer></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header>
|
2020-04-09 10:30:15 +00:00
|
|
|
<h1>{{room}}</h1>
|
2020-04-09 10:19:11 +00:00
|
|
|
</header>
|
|
|
|
|
|
|
|
<main>
|
2020-04-09 10:30:15 +00:00
|
|
|
<h2>Oh hi, {{name}}</h2>
|
|
|
|
|
|
|
|
<button id="buzzer">
|
|
|
|
BUZZ
|
|
|
|
</button>
|
2020-04-09 10:19:11 +00:00
|
|
|
</main>
|
2020-04-09 11:04:28 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
let socket = new WebSocket(`wss://${window.location.hostname}`);
|
|
|
|
|
|
|
|
socket.onopen = function(e) {
|
2020-04-09 11:16:26 +00:00
|
|
|
socket.send({
|
|
|
|
type: "join",
|
|
|
|
data: {
|
|
|
|
participantId: '{{participantId}}',
|
|
|
|
participantName: '{{participantName}}',
|
|
|
|
}
|
|
|
|
});
|
2020-04-09 11:04:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
socket.onmessage = function(event) {
|
2020-04-09 11:16:26 +00:00
|
|
|
|
2020-04-09 11:04:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
socket.onerror = function(error) {
|
|
|
|
alert(`[error] ${error.message}`);
|
|
|
|
};
|
|
|
|
</script>
|
2020-04-09 10:19:11 +00:00
|
|
|
</body>
|
|
|
|
</html>
|