Send Message To Webclient From Headless?

Forum to discuss the Web client version of Servoy.

Send Message To Webclient From Headless?

Postby bobcusick1332964082 » Thu Oct 24, 2013 8:31 pm

I have a long-running process that runs via a CRON in headless on the server.

The user can spawn another instance of the headless running the same solution in the application.

So far, so good.

What I would like to do - is when the headless process is done running - is to send a message (or trigger a global method) on the CLIENT that started the process.

Right now I'm just sending an email when the job is done.

I tried using the UserManager plug-in, but it will only trigger global methods and send a message to the SMART client, not the WEB client.

Is this even possible?
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm

Re: Send Message To Webclient From Headless?

Postby sbutler » Thu Oct 24, 2013 10:27 pm

If the WebClient triggered the Headless Client to open and run a method using the HeadlessClient plugin, then you will automatically get a callback in the queueMethod function.

If the processes are running in a CRON (so not triggered through headlessClient plugin) then you'll have to build something more fancy. So you have a few options...
1. You could implement some client side polling to a RESTful webservice you build that checks if the process is done. You could also do this server side via the schedule plugin. So you somehow check if its done, if so, then run what you need to run.

2. Use servoy's built-in data broadcasting! So, in your application, I assume you have a user record. Add a column in there for user_alerts. Show the user_alert column for the logged in user somewhere on your app in the header or footer where they could always see it. Make it an HTML_AREA. Then in your server side CRON process, when it finishes a job for a user, write to the user_alerts column for the users record, like <html><b>Your Job finished.</b> <a href="javascript:global.method...">Click Here for more info</a></html>
So, the user would just visually see the alert. Then clear it out after they click on it to acknowledge the alert.

I'd go with #2.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Send Message To Webclient From Headless?

Postby bobcusick1332964082 » Thu Oct 24, 2013 10:47 pm

AH! Good idea! I was sort of going down the road of #2 - but I thought I was just being lame... :D

Thanks very much for the ideas, Scott!!
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 4 guests