[Flutter] [Realtime Database] Still receive the log related to removed listenes

I have an issue with Flutter SDK when using Realtime Database.
After removing all listeners from event handle, I still receive the log related to that removed listener. See below log from Android:

I/cketIOConnectionManager( 3648): Got sub res
I/RTClient( 3648): subscription result [[B@bfcaebc]
I/RTClient( 3648): Got result for subscription 14057C0C-5E3C-D981-FFBA-994197FF8D00
I/cketIOConnectionManager( 3648): Got sub res
I/RTClient( 3648): subscription result [[B@10490fd]
I/RTClient( 3648): Got result for subscription 304F1440-DD4A-16F8-FFAA-D772F8C7A600
I/cketIOConnectionManager( 3648): Got sub res
I/RTClient( 3648): subscription result [[B@b26dd4a]
I/RTClient( 3648): Got result for subscription 213AA179-0F7A-58CC-FFF6-9025483BD400
I/flutter ( 3648): New Event object has been created. Object ID - 8D8F500C-0519-4BDD-81C2-104E4194D3EC

Steps:
1, Create EventHandler
EventHandler<Map> eventChangesHandler = Backendless.data.of(BLEvent.tableName).rt();
2, Add create listener:

eventChangesHandler?.addCreateListener((createdEvent) {
  print(
      "New Event object has been created. Object ID - ${createdEvent['objectId']}");
}, whereClause: query);

it will show this log - generate RTSubscription{id=‘14057C0C-5E3C-D981-FFBA-994197FF8D00’:

try to subscribe RTSubscription{id='14057C0C-5E3C-D981-FFBA-994197FF8D00', callback=com.backendless.rt.data.EventHandlerImpl$5@60c56b9, subscriptionName=OBJECTS_CHANGES, options={whereClause=(age >= 3 and age <= 20), event=created, tableName=BLEvents}}
I/cketIOConnectionManager( 3648): Socket is connected

2, Remove all create listener
eventChangesHandler?.removeCreateListeners();
3, Add create listener:

eventChangesHandler?.addCreateListener((createdEvent) {
  print(
      "New Event object has been created. Object ID - ${createdEvent['objectId']}");
}, whereClause: query);

it will show this log - generate RTSubscription{id=‘304F1440-DD4A-16F8-FFAA-D772F8C7A600’

try to subscribe RTSubscription{id='304F1440-DD4A-16F8-FFAA-D772F8C7A600', callback=com.backendless.rt.data.EventHandlerImpl$5@e2350c8, subscriptionName=OBJECTS_CHANGES, options={whereClause=(age >= 3 and age <= 20), event=created, tableName=BLEvents}}
I/cketIOConnectionManager( 3648): Socket is connected

4, Remove all create listener

eventChangesHandler?.removeCreateListeners();

5, Add create listener:

eventChangesHandler?.addCreateListener((createdEvent) {
  print(
      "New Event object has been created. Object ID - ${createdEvent['objectId']}");
}, whereClause: query);

it will show this log - generate RTSubscription{id=‘213AA179-0F7A-58CC-FFF6-9025483BD400’

try to subscribe RTSubscription{id='213AA179-0F7A-58CC-FFF6-9025483BD400', callback=com.backendless.rt.data.EventHandlerImpl$5@a568561, subscriptionName=OBJECTS_CHANGES, options={whereClause=(age >= 3 and age <= 20), event=created, tableName=BLEvents}}
I/cketIOConnectionManager( 3648): Socket is connected

6, Create a new object to trigger create event.
it will show this log:

I/cketIOConnectionManager( 3648): Got sub res
I/RTClient( 3648): subscription result [[B@bfcaebc]
I/RTClient( 3648): Got result for subscription 14057C0C-5E3C-D981-FFBA-994197FF8D00
I/cketIOConnectionManager( 3648): Got sub res
I/RTClient( 3648): subscription result [[B@10490fd]
I/RTClient( 3648): Got result for subscription 304F1440-DD4A-16F8-FFAA-D772F8C7A600
I/cketIOConnectionManager( 3648): Got sub res
I/RTClient( 3648): subscription result [[B@b26dd4a]
I/RTClient( 3648): Got result for subscription 213AA179-0F7A-58CC-FFF6-9025483BD400
I/flutter ( 3648): New Event object has been created. Object ID - 8D8F500C-0519-4BDD-81C2-104E4194D3EC

You can see, we still receive the log “Got result for subscription…” for subscription 14057C0C-5E3C-D981-FFBA-994197FF8D00 and 304F1440-DD4A-16F8-FFAA-D772F8C7A600 even they are removed.
My questions are:
1, Does it affect our usage? Are we still charged for data received from the removed events?
2, How to remove those events completely?

Thanks,

Hello @long_nguyen

I’ve created an internal ticket BKNDLSS-28754 to investigate this question.

Regards

after addCreateListener and removeCreateListeners 5 times. I got this error
got error {code=0, details={limit=5}, message=Reached Limit: you can not have more then 5 subscriptions per one connection}
It seems removeCreateListeners is not working on flutter.
@viktor.liablin

Hi @long_nguyen

I’ve increased the ticket’s priority, our Flutter engineer will take a look into it asap

Regards, Vlad

Hello, @long_nguyen.

Could you clarify on which platforms the error occurs(ios, android, web)?

Best Regards, Nikita.

It’s happening on Android. I did not test on iOS yet @Nikita_Fedorishchev

Hello, @long_nguyen.

The error was reproduced only on Android.
The problem has been fixed. Update backendless_sdk to latest version 7.2.4.
Please let me know if everything is working as it should now.

Best Regards, Nikita.

@Nikita_Fedorishchev It’s working perfectly now, thank you so much.

1 Like