cancel
Showing results for 
Search instead for 
Did you mean: 

Effective update on UI5 via websocket/OData

Former Member
0 Kudos

Hi,

First of all I'm a beginner from every aspect in the web development.

However I created a small application (some kind of online monitoring) which displays backend data and refreshed automtically as soon as something relevant is changed on the backend.

Shortly: UI table binded to OData model and I do a model refresh when a message arrives via websocket.

This works, but not the best from performance perspective.

I mean it would be better if only the changed entry would be refreshed or only the relevant entry would be added/deleted on the UI correspondingly to the backend change. 

Is there any recommendation how it should be implemented?

How should be the change communicated via websocket?

How can I refresh only a part of the model/ui table?

Thanks for your help in advance.

Regards,

Gyula

Accepted Solutions (1)

Accepted Solutions (1)

maartenf
Participant
0 Kudos

Hi Gyula,

You could look at the basic delta query support functionality of gateway. Refer to this blog. However There are some limitations (most important one for me, this is only supported for XML responses) but these are also discussed in the blog.

tldr; basically a token will be created when requesting an entityset. On subsequent read entityset requests, you'll have to add this token and the server will only return the data which has been changed, deleted or created since the time you did the first request. Everytime you read the entityset a new token will be generated.

I hope this is helpful!

Best regards,

Maarten

Former Member
0 Kudos

Hi Maarten,

First of all thanks for the valueable hint.

I went through on the mentioned (and some related) topic and I understand the backend side and how it works, but how should look like the UI5 part?

  1. Should I "store" the last token on client(UI5) side or I should somehow read the last token on backend side (if it is possible at all) and pass this via the websocket?
  2. Beginner question: what is the best practise to update the OData link with the new token and force the rereading? Can I simply call the refresh of the modell after the link is changed?

Regards,

Gyula

PMarti
Active Participant
0 Kudos

Hi Gyula, this post could help you:

maartenf
Participant
0 Kudos

Hi Gyula,

  1. Should I "store" the last token on client(UI5) side or I should somehow read the last token on backend side (if it is possible at all) and pass this via the websocket?
  2. Beginner question: what is the best practise to update the OData link with the new token and force the rereading? Can I simply call the refresh of the modell after the link is changed?

I'm not really sure, I don't have experience with web sockets yet... If I understand correctly when rereading your opening post, you receive a notification the moment you want to update the data. Then it depends how you have implemented your view and what you really want to achieve.

Some technical info regarding URL parameters: (Demokit v2.ODataModel)

When you create the ODataModel, you can pass a map of custom URL parameters to the constructor. It is then appended to every call of the ODataModel. Also when calling the read method of the model you can pass additional url parameters. But as I said, it depends on your implementation.

Did you already create a test application for this? Maybe you can share some code of what you already have. In that way it is easier to give a clear answer.

Best regards,

Maarten

Answers (2)

Answers (2)

0 Kudos

Hi Gyula,

We also have a similar requirement i.e need to send the Notification to a webapplication using websocket, when ever there is data changed in SAP .

I am very new to websocket concept.

Could you guide me how to assign the Odata service to websocket/Push channel .Do we need to have any generic ODATA service as I see a unique service tagged to websocket in S4hana system .

Thanks & Regards

RR

daniel_ruiz2
Active Contributor
0 Kudos

hi Gyula,

Can't you just send the data that changed directly to the client and do a manual model update?

Cheers,

Dan.