Hi,
I’m implementing messaging for an iOS application and I wanted to know if/how I could subscribe to a topic on the backend side. The code for doing so on the application side seems straightforward but haven’t seen anything in the documentation in my search to find how to do so on the backend.
Thank You.
Hi @Innocent_Nwaukwa ,
Unfortunately you can’t subscribe to the messages on the backend side since backend code runtime does not live permanently. Instead it is created each time when request is made.
Regards, Andriy
That makes sense.
Is there some way to trigger an action on the backend upon updating a table?
(Or would it be preferable for me to create a separate topic rather than asking that in this same thread?).
@Innocent_Nwaukwa ,
Yes, you can use event handlers for this. There a set of before/after event handlers for Data service which allow you to add additional logic which will be executed on each request of specific type for given table.
Documentation does not provide list of all available handlers but you can check them in Console - “Quick start > Cloud code > Handlers”. On that page click “New even handler” and select “Data tables” category. Then you will see “event” drop-down in which all available events will be listed.
You can create these handlers in Codeless, JS and Java. More details about how to create event handlers you can find here:
Regards, Andriy
1 Like