Realtime issue

We have a simple table (Queue) which has 2 columns, first column (1:1) relationship with (Venue table), second column is (1:n) with (Tickets table)

our requirement is to monitor realtime updates in the number of tickets in the que.

What we have attempted so far:

  • Realtime update listener on the Queue Table.
    issue: realtime does not work for relationship changes (add/remove) as a relation is not a real object its a reference.

  • Add a new column which keeps count of the related objects, which would trigger the realtime update.
    issue: the relationship get created/deleted via event handler on the Tickets table, we created an event handler for the afterAdd/delete relationship on the Queue table but that dose not work as event handlers don’t call other event handlers.

Options we are looking into:

  1. use a generated column to count the related objects (wondering if that would actually work) and or that value change will trigger realtime update?

  2. least desirable option what would work, (although not optimal as Tickets table will contain many records for all Venues) is to monitor add/delete on Tickets table and set a where clause for the realtime listener.

Any ideas or workarounds or suggestions will be highly appreciated.

Hello @Omar_Darwish, thank you for the question.

realtime does not work for relationship changes (add/remove) as a relation is not a real object its a reference.

actually, realtime(rt) works for add/remove relations for JS, iOS and soon it will be available for java/fluter. But the feature is not documented. What sdk do you use?

Thank you Sergey for the reply.

Merry Xmas to everyone at backendless.

I am currently using codless for the add/delete relationship, however I am adding the realtime listener in IOS sdk.

during our trials we where adding an update listener to the Queue Table, to monitor add/remove relations on the Queue object I.e the parent object in this case. However we are not receiving updates, should we be adding an add and delete listener to the Queue table in this case or the realtime update should be trigged? and we should revisit our code snippet.

1 Like

thank you @Omar_Darwish. Merry Xmas :santa:

here 6.0.1 build by olgadanylova · Pull Request #166 · Backendless/Swift-SDK · GitHub you will find signatures which you should use for listen to relation changes

Thank you very much.

All sorted now

Hey Sergey,

We got things moving and we are successfully monitoring relationship add/delete however in the IOS SDK the returned object is a ResponseStatus object and contains the parent and children objectIds.

we are inquiring about why dosent the update listener return the parent object or the all the children like the normal listener as in our case with a deleteRealationListner we only get the objectId which the Relation was deleted.

is there away to return the parent object without making an Api call when the relationship change listeners are triggered?

thank you

Hello @Omar_Darwish,

now there is no way to get the parent object, instead of objectId. I have created an investigation ticket BKNDLSS-23603 to figure out if it is possible

Thank you Sergey for the reply, for the time being we will be implementing our own logic to retrieve the parent object.