Skip to content

client-presence: Mark disconnected clientId to sessionId mappings #24865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
5 changes: 5 additions & 0 deletions packages/framework/presence/src/systemWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type { AnyWorkspace, StatesWorkspaceSchema } from "./types.js";
*/
interface ConnectionValueState extends InternalTypes.ValueStateMetadata {
value: AttendeeId;
disconnected?: true;
}

/**
Expand Down Expand Up @@ -218,6 +219,10 @@ class SystemWorkspaceImpl implements PresenceStatesInternal, SystemWorkspace {
if (!attendee) {
return;
}
const knownSessionID = this.datastore.clientToSessionId[clientConnectionId];
assert(knownSessionID !== undefined, "Known attendee not found in datastore");
// Mark this client connection ID as disconnected.
knownSessionID.disconnected = true;

// If the local connection is being removed, clear the stale connection timer
if (attendee === this.selfAttendee) {
Expand Down
Loading