 => open());
		closeButton.addEventListener("click", () => close());
		sendStringButton.addEventListener("click", () => send("Client event"));
		sendArrayBufferButton.addEventListener("click", () =>
			send(new ArrayBuffer(10))
		);

		function open() {
			if (ws) {
				console.log("WebSocket already open");

				return;
			}

			ws = new WebSocket(`${location.origin.replace(/^http/, "ws")}/websocket`);

			ws.addEventListener("message", (event) => {
				console.log("Received server event", event.data);
			