mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-13 06:10:01 -04:00
clean test code
This commit is contained in:
parent
f067d1e09c
commit
01bf3b3002
2 changed files with 1 additions and 32 deletions
|
@ -156,36 +156,6 @@
|
|||
}
|
||||
|
||||
(window as any).bare = new BareClient();
|
||||
|
||||
(window as any).a = (_) => {
|
||||
let socket = bare.createWebSocket();
|
||||
|
||||
socket.onopen = function (e) {
|
||||
alert("[open] Connection established");
|
||||
alert("Sending to server");
|
||||
socket.send("My name is John");
|
||||
};
|
||||
|
||||
socket.onmessage = function (event) {
|
||||
alert(`[message] Data received from server: ${event.data}`);
|
||||
};
|
||||
|
||||
socket.onclose = function (event) {
|
||||
if (event.wasClean) {
|
||||
alert(
|
||||
`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`
|
||||
);
|
||||
} else {
|
||||
// e.g. server process killed or network down
|
||||
// event.code is usually 1006 in this case
|
||||
alert("[close] Connection died");
|
||||
}
|
||||
};
|
||||
|
||||
socket.onerror = function (error) {
|
||||
alert(`[error]`);
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if ready}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue