Mendix object change not showing for other users/windows
Hello Mendix Community, I am attempting to create a very simple quiz app on the Mendix Cloud. However, it is paramount (and I mean super-duper strict requirement!) that it works for multiple users to see the questions/quiz at the same time, in real time. For this, I have created an entity which is retrieved from the server as a singleton (i.e. there can only exist one of these, ever.) object – and if this object changes, I want all users to see this change. However, if I try Save the changes to the object using a DataView with the default Save button, only the current user who clicked the Save button will see the change. I tried to test this with two browser windows. Security: Only users with the Administrator role can write to the object – normal users can only read from it. I am coming from a Software Engineering background, and have already made a websocket endpoint which I can broadcast messages from microflows to try circumvent this potential limitation of Mendix, if it truly is ‘by design’ that updates to mx objects aren’t seen real-time for other users. But in Mendix 9, I don’t see any explanation of how or where to force my dataviews to refresh themselves. Refreshing the whole webpage is unacceptable :) TL;DR: I need all users to see changes made to a mendix object in real-time. This is not happening with using a DataView and default Save button. P.S.: I am using Mendix 9.8.0, but the dropdown list does not support that version yet. Thank you in advance and happy weekend, Andreas
The clients (browsers) ofother users need a signal that they need to refresh (get the newer version of) that object.
One way to do this is by letting each client poll (every few seconds), which still has a delay (the interval) and puts a load on the server (and database) specially if you have many users.
Another way to do this is with a widget from the appstore called Pusher which allows you to signal all the clients to refresh and then trigger the refresh flow. This is probably the best and easiest option.
Or you need to get familiar with websockets and create something yourself=)