Title: Messaging child programs Post by: Snorri B. on October 22, 2019, 12:19:44 pm Hi.
I have a program that can potentially fire up one or more children (RUN WITHOUT WAITING). In some cases I'd like to notify the children if the content in the parent program changes. The only way apparently is to send a signal (interrupt/quit) to the children and there you have to check for the QUIT_FLAG / INT_FLAG etc. Then you have base.messageserver (does not work via GAS). I'm wandering if there is any other way to do this. Thanks in advance, -Snorri Title: Re: Messaging child programs Post by: Sebastien F. on October 22, 2019, 12:43:45 pm Hi Snorri,
An option that I recommend to handle application events, is to have the parent program write to a database table with "events". Then any (child) program can from time to time query that table (triggered by an ON IDLE) The advantage of this solution is that you keep the trace of the events, and you can define as much info as you want to filter, mark as read/processed, etc... Code
But maybe that's over-engineered for your case... Seb Title: Re: Messaging child programs Post by: Reuben B. on October 22, 2019, 11:43:25 pm I'd second Seb, although perhaps use ON TIMER instead of ON IDLE
One other thing, have a study of how the Mobile world handles similar issue, Notifications http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_mobile_push_notifications.html and http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_mobile_push_notif_app_side.html. Namely the 3 mobile front-calls http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_frontcalls_mobile.html to registerForRemoteNotifications, unregisterFromRemoteNotifications, and to getRemoteNotifications, and the special predefined action for mobile of ON ACTION notificationpushed. I'd suggest constructing your solution so that Code
could one day be replaced by Code
Reuben Title: Re: Messaging child programs Post by: Leo S. on October 23, 2019, 12:06:39 am Hi Snorri, if base.MessageServer would work via GAS the same way as in direct mode, would that solve your problem ?
Otherwise it would be nice if you could give more details about your particular use case. Regards, Leo Title: Re: Messaging child programs Post by: Snorri B. on October 23, 2019, 01:28:11 am Hi guys and thanks for the input.
Maybe I should explain in more detail what I am trying to achieve. Consider a simple application, Customers, Orders and Invoices. The main program has the customer detail (query/input/display, next, prev etc.) The user selects a customer and fires the Orders action, The Orders program is RUN WITHOUT WAITING. It will display the orders for that particular customer. Then the user selects a different customer. Then I would like to notify the Orders program to get the orders for that customer. Same goes for Invoices, maybe both are open at the same time. So In my case, ON TIMER / IDLE would not do the trick as it would perhaps delay the refresh for too long and confuse the user. Notifications like in the mobile environment would work, and probably base.MessageServer. The events would be passed on through the database like Seb suggested. Best regards, -Snorri |