SAP has developed, a few years ago, a way to push events (messages) from server to client without having the end user click any button or do any action.
The main purpose of this feature was to have a chat application between Portal users.
This method is called RTMF.
Since RTMF is deprecated and due to performance reasons, there are 2 alternatives for the same type of functionality:
- HTML5 websocket which can be read more about here:
- SAP WebDynpro “TimedTrigger” element.
In this blog, I’ll explain how to use the 2nd option.
In order to have a push channel in your WebDynpro application, you simply add the TimedTrigger element to your view (don’t worry, the element is not visible when the application is running).
In the properties of the element, set the delay time (polling interval) to a desired time, for example 2 seconds.
The element also has an “enabled” property which can be bind to a Boolean attribute so you can switch on and off the polling to the server.
In the “events” tab of the element, create an event handler for the onAction event.
This handler will be called every 2 seconds and in that method you can implement the logic that you want to perform.
The biggest advantage of the TimedTrigger element is that you can have your heavy and long running logic run in the background while the UI is not stuck waiting for a response about the long running operation.
I’ve created a sample WD application which is an empty view that only has a timedTrigger element set to 2 senconds and recorded the HTTP requests with HTTPWatch and this is the result:
As seen, every 2 seconds, a request is being sent to the server, to the application I have created.
You should know that there is another type of WD element which offers the same functionality called MessageBasedTrigger.
This element is using RTMF as the framework that delivers data from server to client, but since RTMF is deprecated, you should not use it as well.
Hope this blog will help you in your development of WD applications.
Official documentation for TimedTrigger: