Listeners "addUpdateListener" and "addSetRelationListener" not work correct

Hello Backendless team!

I ran into a problem. The listeners:
public func addUpdateListener(whereClause: String, responseHandler: ((Any) → Void)!, errorHandler: ((Fault) → Void)!) → RTSubscription?

public func addSetRelationListener(relationColumnName: String, parentObjectIds: [String], responseHandler: ((RelationStatus) → Void)!, errorHandler: ((Fault) → Void)!) → RTSubscription?

work properly only with particular (1-2 objects only) in my table. A couple of weeks ago I didn’t notice any problems with it…
What could be the cause of the problem?

I also use
public func addCreateListener(whereClause: String, responseHandler: ((Any) → Void)!, errorHandler: ((Fault) → Void)!) → RTSubscription?
“addCreate” listener in my project and it works perfect…

Thanks.

Hi @Dmitry_Kalenkov,

To resolve your issue, can you specify which specific objects in your application it works with and which it doesn’t, so we can track down the problem?

Regards
Nazar

Hi @Nazar_Dmytryshyn,
What kind of data are you waiting from me?
AppId: AA8505D3-C1B1-9735-FFFA-921A1D1E4F00
TableName: ProductServerModel
Works with objectId’s: D07064AB-46B2-45B4-ACC2-F2E51C985DC6, D9EEAF2C-55F7-44D4-871F-E0A2E1619CC6
Don’t works with others, i.e:
04FF324F-D2AA-4585-8882-445DC7FEC125,
83DE9B2F-1190-418F-BFC5-3B31D121A3AD, etc…

@Dmitry_Kalenkov,

Thank you for the information provided.
Also, could you provide us with a part of your code that you are using, with your listener and ‘whereClause’ condition?

Regards
Nazar

@Nazar_Dmytryshyn,

var productUpdatedEventHandler = Backendless.shared.data.of(ProductServerModel.self).rt
func createListenersForProduct(objectId: String)  {

        let _ = productUpdatedEventHandler?.addUpdateListener(whereClause: "objectId = '\(objectId)'",
                                                              responseHandler: { [weak self] updatedObject in
            print("==== Detect update Object: \(updatedObject)")
        }, errorHandler: { fault in
            print("Error: \(fault.message ?? "")")
        })
        
        let _ = productUpdatedEventHandler?.addSetRelationListener(relationColumnName: "applicant",
                                                                   parentObjectIds: [objectId],
                                                                   responseHandler: { [weak self] updatedObject in
            print("==== Detect update relation 'applicant': \(updatedObject)")
        }, errorHandler: { fault in
            print("Error: \(fault.message ?? "")")
        })
        
    }
}

@Dmitry_Kalenkov,

Thank you for providing the details of the issue. I have created an internal ticket to investigate the issue.
We will let you know about any updates on this issue.

Regards
Nazar

@Dmitry_Kalenkov,

We tried to reproduce this problem in our applications. We also tried it in your app and everything is working correctly for us.
Can you confirm that the problem is still reproducing for you?

Regards
Nazar

@Nazar_Dmytryshyn ,
Yes it is reproducing… I also tried “addAddRelationListener” and result is same…
I tried reinstall app on iphone, relogin and still only 2 objects constantly works perfect… I can’t find any consistent pattern…

This screenshot illustrate breakpoint for particular objectId. This means that there are no errors in my code…

But for the others id’s this breakpoint is silent… It is very strange.
Maybe i have to reinstall backendless app?..

Hello @Dmitry_Kalenkov,

Unfortunately as we are not able to reproduce this issue, I should ask about additional steps.
Could you please provide more information, how do you call this method?

func createListenersForProduct(objectId: String)

How do you pass objectIds in it?
How do you call the set relation and update methods?

Please provide the step by step instruction so we can see the whole picture.

Regards,
Olha

Hello @olhadanylova, thanks for your participation.
As I said above my code does’t have any mistakes. I write it according backendless documentation, and is works really good.

Also i can fix the problem: i remove my user record from db and have registered again. Now all listeners works, and it is good…
But the open question is: what if in the future, my real users bump into this problem as well… I would never know this… What exactly could go wrong?

@Dmitry_Kalenkov ,

It is nice to hear that you found way in which forced RT events work correctly for you. We continue to investigate this issue from our side.

Regards, Andriy

1 Like