Using WebSockets  - how to trigger event on CRUD operation?

Hello,

Here's a quick overview of my app: the Core Service module exposes a REST API that performs a CRUD operation on an entity. When a CRUD operation occurs, I want to trigger an event in this Core Service module that gets handled by a listener in the End User module. To achieve this, I was thinking about using a Websocket to push an event from server to client. I'm considering one of these plugins:

https://www.outsystems.com/forge/component-overview/10677/reactive-pusher-client

https://www.outsystems.com/forge/component-overview/10916/reactive-socketio-client

Implementing the client-side event listener through the plugin looks straightforward, but how do I implement the server-side event trigger when the CRUD operation occurs? Would I have to set up an external server running the Websocket that creates the channel/event? If so, how would I integrate that server with Outsystems so that it triggers an event when a CRUD operation occurs in my entity?

I've never used Websockets with Outsystems or otherwise. If anyone has experience with these plugins, I'd greatly appreciate some guidance.

Hi Sherif,

I don't need to run a specific server action after performing a CRUD operation; rather, I need my UI module to run a *client* action after somehow being notified that the CRUD operation (triggered by an exposed API) occurred. Therefore, I don't think BPT would be much use.

Anyway, I recently discovered a new, great component — called SSE Push Event Hub and Client — that allows for Server-Sent Events without any 3rd party integration. It's not a websocket since it doesn't allow 2-way communication, but you can trigger events on the server-side that can be handled on the client-side. I highly recommend this component for anyone who has a similar use case!

mvp_badge
MVP

Hi Robert,


There are several components to do that, the most commonly used are Firebase and OneSignal.

I would advise you to check the Firebase one which has a comprehensive documentation on how to set it up and achieve this use case. As you can see by the number of downloads it is very used across the community.


Kind Regards,
João

Hi João,

The Firebase component relies on a deprecated firebase feature (database secrets), so I don't think I can use that. Also, OneSignal doesn't have a Reactive component. Are there any other approaches I can take?

Hello @Robert Grosso,

as i understand from your question that you need to run specific server action after doing some CRUD operation, there is some option that may help you.

  • Specify the entity that you need to trigger its operations
  • That you can create a new process from the "Process" tab in the service studio
  • specify the "Launch On" attribute to "Create EntityName"
  • Then you can create "AutomaticActivity" to run your specific server action.


Hope that i understood your question correctly and this helps you.

Sherif Diab,

Hi Sherif,

I don't need to run a specific server action after performing a CRUD operation; rather, I need my UI module to run a *client* action after somehow being notified that the CRUD operation (triggered by an exposed API) occurred. Therefore, I don't think BPT would be much use.

Anyway, I recently discovered a new, great component — called SSE Push Event Hub and Client — that allows for Server-Sent Events without any 3rd party integration. It's not a websocket since it doesn't allow 2-way communication, but you can trigger events on the server-side that can be handled on the client-side. I highly recommend this component for anyone who has a similar use case!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.