From e053814ab5054e465dd179f57e0f2f3151f1de04 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Tue, 13 Aug 2024 21:16:41 +0100 Subject: [PATCH] don't broadcast change onError jusy like onCHange --- app/durableObjects/ChatRoom.server.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/durableObjects/ChatRoom.server.ts b/app/durableObjects/ChatRoom.server.ts index 16c3f32f..3ac5e638 100644 --- a/app/durableObjects/ChatRoom.server.ts +++ b/app/durableObjects/ChatRoom.server.ts @@ -198,7 +198,11 @@ export class ChatRoom extends Server { } onError(): void | Promise { - this.broadcastState() + // while it makes sense to broadcast immediately on close, + // it's possible that the websocket just closed for an instant + // and will reconnect momentarily. + // so let's just let the alarm handler do the broadcasting. + // this.broadcastState() } alarm(): void | Promise {