Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/realtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
"@sim/workflow-types": "workspace:*",
"@socket.io/redis-adapter": "8.3.0",
"drizzle-orm": "^0.45.2",
"lib0": "0.2.117",
"postgres": "^3.4.5",
"redis": "5.10.0",
"socket.io": "^4.8.1",
"y-protocols": "1.0.7",
"yjs": "13.6.31",
"zod": "4.3.6"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions apps/realtime/src/handlers/connection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createLogger } from '@sim/logger'
import { parseRoomName, type RoomRef, roomName } from '@sim/realtime-protocol/rooms'
import { cleanupFileDocForSocket } from '@/handlers/file-doc'
import { cleanupPendingSubblocksForSocket } from '@/handlers/subblocks'
import { cleanupPendingVariablesForSocket } from '@/handlers/variables'
import type { AuthenticatedSocket } from '@/middleware/auth'
Expand Down Expand Up @@ -31,6 +32,9 @@ export function setupConnectionHandlers(socket: AuthenticatedSocket, roomManager
// Clean up pending debounce entries for this socket to prevent memory leaks
cleanupPendingSubblocksForSocket(socket.id)
cleanupPendingVariablesForSocket(socket.id)
// Clear the socket's collaborative-document awareness (removes its caret for
// everyone else) and drop the room if it was the last editor.
cleanupFileDocForSocket(socket.id, roomManager.io)

// A socket may occupy multiple rooms (one per type). Remove it from every
// room the manager knows about.
Expand Down
Loading