Hello Forum.
We use servoy in a heterogenous environment. Recently we
found the following idea interesting:
Is it possible – or how is it possible – to do real callbacks to a
running servoy client? Im a thinking of the following setup:
- A user starts a client on his host machine, connecting to the servoy server
and running a solution. Thats what we always do.
- He triggers some action in another application – lets say by invoking an URL
in a browser, stepping through a web-based wizard.
- Having finished the wizard stuff in the browser he presses the
“Ok, I am done”-Button. Lets say the webapp modified a database
table or created new database records.
- It would be really nice to then tell the servoy client of the actions
which have been taken; i.e. to inform the client on this specific host to
display a dialog “Should the changes from the web be displayed?”
or the like.
I know that sending a message to the client is possible from the server application,
killing the client is possible as well.
Imagine the following way to do it:
When servoy steps to the webapp, the URL gets a parameter with a unique
client identifier. When the webapp is finished it calls a headless client with this
id as a parameter. The headless then does a lookup (how?) to resolve to the
client in request and invokes a method there.
Is this possible? Is there a different way to realize a callback to a specific but known servoy client?
Thinking in servoy - part 1.
Any thoughts and hints kindly appreciated
Michael Wirz
Munich
If you have a web page and want to link to a method inside Servoy, you can use this
http://<servoy_server_ip>/servoy-client/servoy_client.jnlp?solution=&method=&argument=
So if you build a link in a browser like this, you can call a method to show the information inside Servoy. If the client is not yet started, it will be started using that link.
Hello,
Can u tell the way servoy implements this feature technically?
I can imagine using the IP of the HTTP-Request – which would not work in a
mulit-user environment (many users sharing the same IP).
I can image that the webstarter could check for a running servoy and use an
internal identification of the client – which would not work when running
multiple clients on the client host.
How is it done?
Thanks for hints,
Michael
Without using the RMI transport message stream between Client and Server for the things Servoy needs to do internally, what you could do is write a small timer that starts in each client.
This timer knows the Servoy internal client id.
The timer periodically checks for the said (flag of) changes you describe.
The check could be either via http as discussed or via RMI.
If you are implementing without writing a plugin, use a scheduler call.
If you are implementing java code, do it as RMI.
In either case, the client is always pulling as opposed to a true notification.
You could implement a true notification on the server end via a server plugin, but that’s a significant amount of work. You would need a client plugin to match.
aside : why would you run more than one client per host ? And, if you do, they are uniquely identificable.
Julian
Hi,
Unfortunately I have been busy on other topics the last days.
Thank you for the hint on a polling - mechanism. We might try
it this way as a starting point.
But I do not really like the idea of polling because of its
immanent load.
When thinking about the serverplugin/clientplugin stuff the following
setup comes to mind: On startup the client registers itself at the server.
The server stores a link to a client plugin of that specific client in
order to do the callbacks. Is this a possible schema?
Wouldn’t it be interesting to provide such a service within the framework
in spite of a hacked self-made solution? How would servoy-insiders
implement this solution (having the background of all information
each client and server has – with respect to the point that callbacks
from the server are possible; see the message sending topic)
I’d really appreciate to hear of your thoughts,
Michael Wirz