Skip to content

🐛 Bug Report: Event is triggered multiple times when subscribing to multiple (different) channels #55

Open
@Re-Shard

Description

@Re-Shard

👟 Reproduction steps

Create, Update & Delete events are being triggered multiple times when subscribed to multiple channels.
In the example below there are 2 create events when a userimage is added.

First subscription:

subscribe() {
    if (userimagesSubscription == null) {
      userimagesSubscription = AppwriteApi.instance.realtime
          .subscribe(['collections.userimages.documents']);
      userimagesSubscription!.stream.listen((data) async {
        if (data.payload.isNotEmpty) {
          // Do some handling..
        }
      });
    }
  }

Second subscription:

subscribe() {
    if (interestSubscription == null) {
      interestSubscription = AppwriteApi.instance.realtime
          .subscribe(['collections.interest.documents']);
      if (interestSubscription != null) {
        interestSubscription!.stream.listen((data) async {
          if (data.payload.isNotEmpty) {
           // Do some handling..
          }
        });
      }
    }
  }

👍 Expected behavior

There should be only 1 trigger event per event.

👎 Actual Behavior

The debug console shows the following:

I/flutter ( 5914): subscription: wss://db.DOMAIN.nl/v1/realtime?project=6234aad9d50bf302d1b5&channels%5B%5D=collections.userimages.documents

I/flutter ( 5914): subscription: wss://db.DOMAIN.nl/v1/realtime?project=6234aad9d50bf302d1b5&channels%5B%5D=collections.userimages.documents&channels%5B%5D=collections.interest.documents

🎲 Appwrite version

Version 4.0.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions