Nicer message when you are alone, fix server URL
This commit is contained in:
parent
a9c6a26091
commit
706a92a9a6
1 changed files with 2 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ import './style.css'
|
|||
|
||||
const presenceInfo = document.querySelector<HTMLDivElement>('#presence-info')!
|
||||
const canvas = document.querySelector<HTMLCanvasElement>('#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.`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue