Skip to content

Commit

Permalink
Merge pull request #72 from cloudflare/update-deps
Browse files Browse the repository at this point in the history
update deps, log muteUser warning correctly
  • Loading branch information
threepointone authored Aug 8, 2024
2 parents d06530b + 11a9138 commit 722b554
Show file tree
Hide file tree
Showing 4 changed files with 526 additions and 405 deletions.
42 changes: 24 additions & 18 deletions app/durableObjects/ChatRoom.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,32 @@ export class ChatRoom extends Server<Env> {
break

case 'muteUser':
for (const otherConnection of this.getConnections<User>()) {
if (otherConnection.id === data.id) {
otherConnection.setState({
...otherConnection.state!,
tracks: {
...otherConnection.state!.tracks,
audioEnabled: false,
},
})
this.sendMessage(otherConnection, {
type: 'muteMic',
})

this.broadcastState()
break
{
let mutedUser = false
for (const otherConnection of this.getConnections<User>()) {
if (otherConnection.id === data.id) {
otherConnection.setState({
...otherConnection.state!,
tracks: {
...otherConnection.state!.tracks,
audioEnabled: false,
},
})
this.sendMessage(otherConnection, {
type: 'muteMic',
})

this.broadcastState()
mutedUser = true
break
}
}
if (!mutedUser) {
console.warn(
`User with id "${data.id}" not found, cannot mute user from "${connection.state!.name}"`
)
}
}
console.warn(
`User with id "${data.id}" not found, cannot mute user from "${connection.state!.name}"`
)

break
case 'partyserver-ping':
Expand Down
Loading

0 comments on commit 722b554

Please sign in to comment.