From 706a92a9a6280eea99dd2da9fdb9f2949515a523 Mon Sep 17 00:00:00 2001 From: arne Date: Sat, 23 Mar 2024 22:31:34 +0100 Subject: [PATCH] Nicer message when you are alone, fix server URL --- client/src/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/main.ts b/client/src/main.ts index 166b08a..d213cab 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -2,7 +2,7 @@ import './style.css' const presenceInfo = document.querySelector('#presence-info')! const canvas = document.querySelector('#canvas')! -const socket = new WebSocket(`ws://${window.location.hostname}:3000`) +const socket = new WebSocket(`${window.location.protocol.replace('http', 'ws')}//${window.location.hostname}/server`) type Message = | { type: 'presence-information', others: number } @@ -95,7 +95,7 @@ socket.addEventListener('message', (e) => { state.others = data.others // TODO: Would be nicer to have this DOM update elsewhere presenceInfo.innerText = 'You see a pond. ' + (state.others === 0 - ? 'You are currently alone here.' + ? 'The place is empty and quiet.' : state.others === 1 ? 'Somebody else is also here.' : `There are ${state.others} others with you.`)