13
Views
3
Comments
In sms app, how to display new message that comes in to exposed REST API?
Question
Application Type
Reactive
Platform Version
11.54.6 (Build 62311)

I have a list of contacts on the left and a list of their messages on the right. 

I have an exposed REST API that creates a Message record and creates or updates a Contact record. 

How can I have the lists of contacts and messages refresh or update when a new contact or message record is created or updated on the server side?

2024-09-30 18-12-10
NathanCain.com

Thank you for pointing me to the path.

I'm following the instructions here https://www.outsystems.com/forge/component-documentation/10975/sse-push-event-hub-o11/0 and I've gotten to the very end where it says That's all for the simplest setup! Whenever the "Broadcast" *Service Action* in the HUB is called by any agent, all clients will receive the issued message.

Can you point me to where I can learn to have the agent call the service action?  I don't recognize that terminology.

2019-01-07 16-04-16
Siya
 
MVP

You may consider Pusher (https://pusher.com/) for your use case. Steps to follow are

  1. Signup an account @ https://pusher.com/
  2. Create a channel ( eg: outsystems-demo-app )
  3. Now you need to implement the code to send message. In order to send you could send it using REST API but they have .net libraries which makes it easier. So Create a new extension say PushServer and add a method "SendMessage" with parameters as Channel , Event Name , Message , AppId, AppKey, AppSecret, Cluster and implement the ASP.NET code given at https://pusher.com/docs/channels/server_api/overview . Do note that you need to install the PushServer Nuget package.
  4. Now consume the SendMessage from extension in the exposed REST API to trigger the message.
  5. Now  coming to client side you need to download the javascript https://js.pusher.com/8.2.0/pusher.min.js and include in your OML and refer in the page. In the OnReady initialise the Pusher and invoke a screen while receiving the message.

I have attached the Extension and Sample OML to demonstrate this for your reference. Do setup the values in Site Properties ( appid, apply, secret, channel, event name , cluster ) and javascript code ( appid, cluster, event name ) as per your configuration. Sample OML has exposed REST API and when data is received it stores in the database and send the message to Pusher. Client side when the message is received will refresh the aggregate.

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