Skip to content
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

fix(client-presence): Remove connectionId for self attendee disconnect #23022

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WillieHabi
Copy link
Contributor

@WillieHabi WillieHabi commented Nov 7, 2024

Description

We currently use Audience to listen for when remote clients disconnect from the session before removing their connection Id and setting their status to disconnected.

This works perfectly fine for remote clients, but for the local client this is not possible since "removeMember" event is not sent to the local client that disconnected.

To fix this we can listen to "disconnected" event on the ephemeral runtime (same way we listen to "connected") to know when the local client disconnects.

@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch labels Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

Copy link
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Coverage Summary

↓ packages.framework.presence.src:
Line Coverage Change: -0.02%    Branch Coverage Change: No change
Metric NameBaseline coveragePR coverageCoverage Diff
Branch Coverage 84.05% 84.05% → No change
Line Coverage 62.14% 62.12% ↓ -0.02%

Baseline commit: 25935ec
Baseline build: 304843
Happy Coding!!

Code coverage comparison check passed!!

@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +245 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 463.61 KB 463.64 KB +35 Bytes
azureClient.js 562.45 KB 562.49 KB +49 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 261.86 KB 261.87 KB +14 Bytes
fluidFramework.js 424.82 KB 424.84 KB +14 Bytes
loader.js 134.17 KB 134.19 KB +14 Bytes
map.js 42.71 KB 42.71 KB +7 Bytes
matrix.js 148.32 KB 148.33 KB +7 Bytes
odspClient.js 528.29 KB 528.34 KB +49 Bytes
odspDriver.js 97.84 KB 97.86 KB +21 Bytes
odspPrefetchSnapshot.js 42.81 KB 42.83 KB +14 Bytes
sharedString.js 164.17 KB 164.17 KB +7 Bytes
sharedTree.js 415.28 KB 415.29 KB +7 Bytes
Total Size 3.36 MB 3.36 MB +245 Bytes

Baseline commit: 25935ec

Generated by 🚫 dangerJS against 8cc21e4

Copy link
Member

@tylerbutler tylerbutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to test this?

Copy link
Contributor

@jason-ha jason-ha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Needs test coverage
  • Should attendeeDisconnected event be fired for self? Feels like no.

Comment on lines +88 to +92
runtime.on("disconnected", () => {
if (runtime.clientId !== undefined) {
this.removeClientConnectionId(runtime.clientId);
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep this runtime dependency out of here and place it in PresenceManagerDataObject where the existing call to removeClientConnectionId is. (We want to keep the runtime dependencies to a minimum.) I assume from this that audience never says "removeMember" for self.

Copy link
Contributor

@jason-ha jason-ha Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I made the wrong comment above. It is cool to have the call here (perhaps better at least for now). The more important thing is consistency. We can move the PresenceManagerDataObject call to here since audience is being added to IEmphemeralRuntime (in #23006) and remove ClientConnectionManager that requires removeClientConnectionId to be public. Related comment from past: #22833 (comment)

@WillieHabi
Copy link
Contributor Author

I think the best way to test this would be through unit testing and manual testing of external controller. I will redirect conversation to this PR #23006 since this change is apart of it and this is where all the test reworking is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants