diff options
Diffstat (limited to 'client-web/source/remote_user.ts')
-rw-r--r-- | client-web/source/remote_user.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/client-web/source/remote_user.ts b/client-web/source/remote_user.ts index a0fdeaf..6cc57a5 100644 --- a/client-web/source/remote_user.ts +++ b/client-web/source/remote_user.ts @@ -10,13 +10,13 @@ export class RemoteUser extends User { peer: RTCPeerConnection negotiation_busy = false - constructor(room: Room, name: string) { - super(room, name) - log("usermodel", `added remote user: ${name}`) + constructor(room: Room, id: number, name: string) { + super(room, id, name) + log("usermodel", `added remote user: ${id} ${JSON.stringify(name)}`) this.peer = new RTCPeerConnection(servers) this.peer.onicecandidate = ev => { if (!ev.candidate) return - room.websocket_send({ ice_candiate: ev.candidate.toJSON(), receiver: this.name }) + room.websocket_send({ relay: { recipient: this.id, message: { ice_candidate: ev.candidate.toJSON() } } }) } this.peer.ontrack = ev => { const t = ev.track @@ -38,7 +38,7 @@ export class RemoteUser extends User { await this.peer.setLocalDescription(offer_description) const offer = { type: offer_description.type, sdp: offer_description.sdp } log("webrtc", `sent offer: ${this.name}`, { a: offer }) - this.room.websocket_send({ receiver: this.name, offer }) + this.room.websocket_send({ relay: { recipient: this.id, message: { offer } } }) } async on_offer(offer: RTCSessionDescriptionInit) { this.negotiation_busy = true @@ -52,7 +52,7 @@ export class RemoteUser extends User { await this.peer.setLocalDescription(answer_description) const answer = { type: answer_description.type, sdp: answer_description.sdp } log("webrtc", `sent answer: ${this.name}`, { a: answer }) - this.room.websocket_send({ receiver: this.name, answer }) + this.room.websocket_send({ relay: { recipient: this.id, message: { answer } } }) this.negotiation_busy = false } async on_answer(answer: RTCSessionDescriptionInit) { |