B4J Question Multi-user Aware Web App

Hanstel

Member
Licensed User
Dear Community,

I have a database app, records are initially loaded on a List Table, selecting a row lands me to the edit form, now, using websocket or any other method, how can I update my List Table automatically on every change of the underlying tables by someone else without refresh or reloading? Very similar to chat app but I don't know how to do it on the above application.

Any help is appreciated.
 

Hanstel

Member
Licensed User
Yes, its a Web App using ABMaterial and MariaDB, actually its a Queuing application, as the visitor arrives they take ticket, this action updates the queue table's timestamp, sequence_no, and category of visit. On the other hand, the agents look at the Queue List Display, here is my question, how can I update this list without a reload.
 
Last edited:
Upvote 0

Anser

Well-Known Member
Licensed User
Longtime User
do not know whether I understood your requirement correctly.

You must have done a Table query to load the data from the remote database table to a list on your ABMApplication right ?

For local refresh during EDIT of data:- Whenever you make changes to the table, you may modify the data in the list and also call an UPDATE query to write the changes to the table on the remote server.

For local refresh during ADD New record:- Whenever a new record is added you may call an INSERT query so that the new record is added on the remote database and at the same time add a new entry to the list of data

But How do you know about the changes made by other users on the table without a requery of the data from the database ?. Without knowing the changes done by other users, your data diaplayed on the list is wrong.

What is limiting you from doing a requery of the data from the table ?. Is it a query that returns huge amount of data ? Or something that put extreme load of the database server ?

I am not good in socket technology, may be you can use a trigger in the UPDATE and INSERT methods in the table that wil send some sort of data to your PC and based on that you can do some refesh of local list. May be I am totally wrong. I read somewhere in this forum a method that can be used in TRIGGERS to call external programs, with that trick you may get some idea.
 
Upvote 0

Hanstel

Member
Licensed User
this method is already being done by ChatShared on chatroom example, my question is how to apply it on this particular scenario
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
As I also told you in the feedback app, I'm looking into writing a 'general' framework to do this communication. But it will still need a lot of work from your side to implement it, as every app is different. While your question can be done in a couple of sentences, the answer isn't.

ABM is a dynamic system, so it can update almost every component from the server side. In your case, you will need to look into ABMTableMutable (the normal ABMTable cannot handle updates without reloading everything). This can quickly become a complex system to handle: how does one handle if multiple users are editing the table at the same time? How to cope with each page's active row? How about deletes? How often does it need to refresh without killing your server?

One scenario could be using a background worker in the server that gets a notification that a record has been changed, and then with a fixed interval (say every minute) broadcasts (just like in the chat example) the changes to the table to each page. But to be safe, you may need to block the user (with page.pause/page.resume) when you are updating his page.

Another scenario could be that you just notify the user something has changed and he can press a refresh button to get the latest data (that is how I would do it).
 
Upvote 0

Hanstel

Member
Licensed User
Just to get started, my objective is to auto-update the list (ABMTableMutable) or card views on every addition or deletion of record.
 
Upvote 0
Top