Skip to content

Commit

Permalink
Little improvement to sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodman committed Dec 18, 2021
1 parent 4a41a4c commit d10eae5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions public/sandbox.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<textarea id="data" style="width: 100%; height: 500px"></textarea><br />
<input id="client" type="text" value="c1" /><br /><br />
<textarea id="data" style="width: 100%; height: 500px"></textarea><br /><br />
<button id="connect">Connect</button>
<button id="push">Push</button>

<script>
const ws = new WebSocket(
"ws://localhost:3000/?clientID=c1&roomID=r1&baseCookie=&ts=" +
performance.now()
);
let ws;

document.querySelector("#connect").onclick = () => {
const clientID = document.querySelector("#client").value;
if (ws) {
ws.close();
}
ws = new WebSocket(
`ws://localhost:3000/?clientID=${clientID}&roomID=r1&baseCookie=&ts=${performance.now()}`
);
};

document.querySelector("#push").onclick = () => {
const data = JSON.parse(document.querySelector("#data").value);
Expand Down

0 comments on commit d10eae5

Please sign in to comment.