ServerPushSessions [message #1065105] |
Mon, 24 June 2013 07:40  |
Eclipse User |
|
|
|
Hi,
I implemented a simple short message functionality: Type in a short message and send it to another user. The message is shown on the other user's display immediately. I use ServerPushSessions in this approach:
- when user logs into application the ui session's display is registered in a static context
- a ServerPushSession is started right away
- when another user sends a message, asyncExec is invoked on the registered receiver's display to show the message
- whenui session is destroyed the ServerPushSession is stopped and the display is removed
I wonder if this is what ServerPushSessions have been designed for. I think that probably polling might be more suitable for this functionality, but I found the ServerPushSession approach interesting.
I use ServerPushSessions in background threads to e.g. hide a "Processing your request..." label when the background thread is done - which is afaik a classic use case for ServerPushSessions. When the above mentioned short message functionality is running, other ServerPushSessions are superfluous because there will always be a running ServerPushSession as long as the ui session is active.
So my questions are:
1. Might technical issues arise when every ui session has an active ServerPushSession while it is alive (because the documenation says to stop unused ServerPushSessions in order to free resources related to it)?
2. Would such an implementation lead to a constant loading symbol on mobile devices (as mentioned here: http://www.eclipse.org/forums/index.php/mv/msg/452311/1007319/#msg_1007319)?
3. Any other disadvantages?
Thanks for any thoughts on this.
Regards,
Sebastian
[Updated on: Mon, 24 June 2013 07:43] by Moderator
|
|
|
Re: ServerPushSessions [message #1065277 is a reply to message #1065105] |
Tue, 25 June 2013 04:21   |
Eclipse User |
|
|
|
Hi Sebastian,
The ApplicationContext is a better place to store the reference to
another user's Display - static means system-wide, i.e. across the VM,
which is more than you need. Moreover, you should think about thread
safety and double check that the reference is cleaned up correctly to
avoid a memory leak.
In contrast to polling, the long-polling approach guarantees an
immediate feedback and spares traffic when there are few updates.
For applications that expect messages at any time, there's no
alternative to starting a global ServerPushSession and keeping it alive.
An active server push leads to a permanent standing request which may
block resources on the server, such as a thread from the servlet
container's thread pool. Whether this is problem probably depends on
your servlet container and maybe network infrastructure. I *think* it
might be problematic for a big number of users, but I've never heard any
complaints so far.
A ServerPush should not lead to a loading icon on mobile devices.
Regards,
Ralf
--
Ralf Sternberg
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
|
Re: ServerPushSessions [message #1221976 is a reply to message #1221272] |
Thu, 19 December 2013 00:05  |
Eclipse User |
|
|
|
Hi, Ralf,
Thank you for your reply!
I tried the sample before, but always got "Invalid thread access", still cannot refresh any other online user's UI control(on another computer) except showing a messagebox by display.asyncExec, due to being busy these days, I'll try it again based on your guide few days later! Thanks again!
|
|
|
Powered by
FUDForum. Page generated in 0.03849 seconds