···447447 logDebug(`Updated lastSyncVersion to ${maxVersion}`);
448448 }
449449450450+ // Notify main thread that changes were applied and force a query refresh
451451+ try {
452452+ // This will trigger a database update event that @vlcn.io/rx-tbl will detect
453453+ // Force a dummy statement that touches the database to trigger update subscriptions
454454+ // Creating a temporary table will cause SQLite to touch the database file
455455+ await connection.db.exec('SELECT 1;');
456456+ } catch (error) {
457457+ logError('Error triggering database refresh:', error);
458458+ }
459459+450460 // Notify main thread that changes were applied
451461 self.postMessage({ type: 'CHANGES_APPLIED', dbname, count: changes.length });
452462
+10-1
server/main.go
···8989 roomsMu.Unlock()
90909191 if !exists {
9292+ log.Printf("Room %s not found for broadcasting", roomID)
9293 return
9394 }
94959596 room.mu.Lock()
9697 defer room.mu.Unlock()
97989999+ clientCount := 0
98100 for client := range room.clients {
99101 if client != sender {
100100- client.WriteMessage(websocket.TextMessage, message)
102102+ clientCount++
103103+ err := client.WriteMessage(websocket.TextMessage, message)
104104+ if err != nil {
105105+ log.Printf("Error broadcasting to client: %v", err)
106106+ }
101107 }
102108 }
109109+ log.Printf("Broadcasted changes to %d clients in room %s", clientCount, roomID)
103110}
104111105112func handleWebSocket(w http.ResponseWriter, r *http.Request) {
···202209 applyChangesToDB(db, data)
203210204211 // Broadcast changes to other clients in the same room
212212+ log.Printf("Broadcasting changes to other clients in room %s", roomID)
205213 broadcastToRoom(roomID, conn, message)
214214+ log.Printf("Broadcast completed for room %s", roomID)
206215 }
207216 }
208217 }