diff options
Diffstat (limited to 'client-web/source')
-rw-r--r-- | client-web/source/protocol/mod.ts | 1 | ||||
-rw-r--r-- | client-web/source/room.ts | 5 | ||||
-rw-r--r-- | client-web/source/user/mod.ts | 2 | ||||
-rw-r--r-- | client-web/source/user/remote.ts | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts index 03afa8e..b225ced 100644 --- a/client-web/source/protocol/mod.ts +++ b/client-web/source/protocol/mod.ts @@ -55,7 +55,6 @@ export class SignalingConnection { } send_control(data: ServerboundPacket) { - log("ws", `-> ${data.relay?.recipient ?? "*"}`, data) this.websocket.send(JSON.stringify(data)) } async send_relay(data: RelayMessage, recipient?: number | null) { diff --git a/client-web/source/room.ts b/client-web/source/room.ts index 53c020f..11a5000 100644 --- a/client-web/source/room.ts +++ b/client-web/source/room.ts @@ -22,12 +22,13 @@ export class Room { control_handler(packet: ClientboundPacket) { if (packet.message) return // let the relay handler do that - log("ws", `<- [control packet]: `, packet); if (packet.init) { + log("ws", `<- [init packet]: `, packet); this.my_id = packet.init.your_id // no need to check compat for now because this is hosted in the same place log("*", `server: ${packet.init.version}`) } else if (packet.client_join) { + log("ws", `<- [client join]: `, packet); const p = packet.client_join log("*", `${p.id} joined`); if (p.id == this.my_id) { @@ -39,6 +40,7 @@ export class Room { ru.offer() } } else if (packet.client_leave) { + log("ws", `<- [client leave]: `, packet); const p = packet.client_leave; log("*", `${p.id} left`); this.users.get(p.id)!.leave() @@ -46,6 +48,7 @@ export class Room { } relay_handler(sender_id: number, message: RelayMessage) { const sender = this.users.get(sender_id) + log("ws", `<- [relay for ${sender?.display_name}]: `, message); if (sender instanceof RemoteUser) { sender.on_relay(message) } else { diff --git a/client-web/source/user/mod.ts b/client-web/source/user/mod.ts index cbe9468..b01dc16 100644 --- a/client-web/source/user/mod.ts +++ b/client-web/source/user/mod.ts @@ -15,7 +15,7 @@ export abstract class User { private _name?: string get name() { return this._name } set name(n: string | undefined) { this._name = n; this.name_el.textContent = this.display_name } - get display_name() { return this.name ?? `guest (${this.id})` } + get display_name() { return this.name ?? `unknown (${this.id})` } constructor(public room: Room, public id: number) { room.users.set(this.id, this) diff --git a/client-web/source/user/remote.ts b/client-web/source/user/remote.ts index 5774740..68dd08f 100644 --- a/client-web/source/user/remote.ts +++ b/client-web/source/user/remote.ts @@ -15,7 +15,7 @@ export class RemoteUser extends User { super(room, id) room.remote_users.set(this.id, this) - log("usermodel", `added remote user: ${id}`) + log("usermodel", `added remote user: ${this.display_name}`) this.peer = new RTCPeerConnection(RTC_CONFIG) this.peer.onicecandidate = ev => { if (!ev.candidate) return |