Author |
Message |
26/08/2008 18:14:18
|
saala
Power User
Joined: 14/04/2008 13:12:41
Messages: 85
Offline
|
Hi,
I want to initiate a update of a client control when a variable on server side change. For example, a label displays the state of a machine. When the state changes, the user should see the new state without any action on the client. Is this possible?
Michael
|
|
|
26/08/2008 18:35:22
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
...the default way is "by polling", which is supported by standard. We do not have an example yet in the demo workplace but will add one within the next update.
Background: we want to keep to http as transfer protocol as close possible as communication between client and server. And we do not want to keep connections open for a long time (no "pushlet").
But: for special situations (in which also special things are allowed...) we/you can define a client side Java component which is called by the server side application directly. Imagine the client opening a mini http server on its own (as part of a component) and the server sending an http request to the client which informs the client to reload data or do anything else. Of course this is something to think through... opening a mini client side http server must be done with care always and must be in synch with secutiy restrictions within the network.
What is your opinion. "Polling is enough" or "need something to be called" on client side (e.g. http server)?
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
27/08/2008 09:04:25
|
saala
Power User
Joined: 14/04/2008 13:12:41
Messages: 85
Offline
|
for the current situation polling whould be enough. We just need an update rate about every 20sec.
For the future I can imagine situations where quit short update rates less then 2sec would be necessary (e.g. barcode scanner that activates a feedback at the client). Do you think polling would be sufficient for this use case?
Michael
|
|
|
27/08/2008 09:47:14
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
20 seconds sounds "healthy" - 2 Seconds is "much too much".
Barcode scanners (or any other subdevices) should not be integrated "from server side" but from client side. you need to provide a component on client side that listens to serial/USB/whatever port and then behaves like a normal input component. From server side processing's point of view it should not be a difference if the user presses a button on client side or operates the scanner.
Writing these components is easy if you know how it works ;-), there is documentation available on how to do this (Component Developer's Guide). But you need to have some knowledge in Swing programming, JSF programming and combining both. - We can support you in writing these components.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
27/08/2008 10:01:34
|
saala
Power User
Joined: 14/04/2008 13:12:41
Messages: 85
Offline
|
the problem is that our barcode scanner are more complex...
They are not attached to a pc but wireless connected to the LAN. Based on Windows Mobile they have an internet browser to display html pages from our server. Using this barcode scanner, the user is going from palette to palette to scan the products. During his work he wants to monitor the progress (we thought also on the eclnt application).
But knowing the restriction we could design the system in another way. Direct feedback only on the scanner itself, a report at the end from the client initiated by the user.
Michael
|
|
|
27/08/2008 11:41:16
|
saala
Power User
Joined: 14/04/2008 13:12:41
Messages: 85
Offline
|
unfortunately I found another mandatory feature that requires a rapid update of the client initiated by the server...
you suggested to create a control that cointains a mini http server, listening for incoming request and updates the client. This sounds very well, but I think a more simple solution would be sufficient for me. There is already a JAVA application running on the pc that recognizes the event. Is there any possiblity to cause the client to update the screen by this separate application?
Michael
|
|
|
27/08/2008 15:47:47
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
Well, the other application on client side still is another Java process. So we need some inter-process communication (I think, solutions like "constant polling against file system" are not really the direction we should target for...).
I see http base access as simplest way... (compared to RMI or native TCP/IP). ...or?
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
27/08/2008 16:40:03
|
saala
Power User
Joined: 14/04/2008 13:12:41
Messages: 85
Offline
|
of course, polling against file system is not a solution.
A more lightweight solution could based on UDP datagrams (java.net.DatagramSocket). But if you think a http server would be better, no problem.
Michael
|
|
|
28/08/2008 07:15:58
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
So, I try to summarize what we will do...:
Provide a component HTTPRECEIVER which opens up a micro-http server on client side. The component is not visible.
Attributes:
PORT ==> port of client http server
ACTIONLISTENER ==> method on server side to be invoked
The method gets an event of type BaseActionEventHttpReceived, which itself passes the full URL that was received on client side.
The application on server side is responsible for parsing the request and for doing securtiy management. The application needs to be aware about that the client side http server could be potencially called from any http-caller as well. E.g. it needs to define a certain token that always needs to be passed as part of the URL.
We will provide this component quite short term...
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
28/08/2008 09:03:07
|
saala
Power User
Joined: 14/04/2008 13:12:41
Messages: 85
Offline
|
Thanks a lot!
Michael
|
|
|
03/09/2008 15:09:34
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5520
Offline
|
Component CLIENTHTTPRECEIVER is part of version 20080901.
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
|