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 for realtime multiple subscription 15x #801

Merged
merged 9 commits into from
Apr 24, 2024

Conversation

lohanidamodar
Copy link
Member

@lohanidamodar lohanidamodar commented Mar 14, 2024

What does this PR do?

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@stnguyen90
Copy link
Contributor

Sorry, I'll try to get to this on Monday.

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

I'm still getting 2 events:

image

@stnguyen90
Copy link
Contributor

@lohanidamodar, I think the problem is if you subscribe multiple times in a loop like:

    try {
      final document = await widget.database.listDocuments(
        databaseId: ID.custom(databaseId),
        collectionId: ID.custom(collectionId), //change your collection id
      );
      for (var doc in document.documents) {
        _subscribe(
            ['databases.default.collections.usernames.documents.${doc.$id}']);
      }
    } on AppwriteException catch (e) {
      print(e.message);
    }

This can be called multiple times, creating multiple websockets. In this case 5:

image

Copy link
Contributor

@abnegate abnegate left a comment

Choose a reason for hiding this comment

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

There's a few places we need to revert back from Appwrite to a template substitution

@lohanidamodar
Copy link
Member Author

There's a few places we need to revert back from Appwrite to a template substitution

Updated

@lohanidamodar
Copy link
Member Author

@stnguyen90 updated

@stnguyen90 stnguyen90 self-requested a review April 15, 2024 18:28
do not close subscription if creating socket is true to prevent concurrent modification error
@lohanidamodar lohanidamodar merged commit 59234d6 into master Apr 24, 2024
34 checks passed
@lohanidamodar lohanidamodar deleted the fix-flutter-realtime-multisub-15x branch April 24, 2024 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants