ServerPushSessions [message #1065105] |
Mon, 24 June 2013 11:40 |
Sebastian Habenicht Messages: 42 Registered: January 2013 |
Member |
|
|
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 11:43] Report message to a moderator
|
|
|
Re: ServerPushSessions [message #1065277 is a reply to message #1065105] |
Tue, 25 June 2013 08:21 |
|
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 #1220855 is a reply to message #1065105] |
Sat, 14 December 2013 13:22 |
David Lee Messages: 78 Registered: May 2013 |
Member |
|
|
Hi, Sebastian Habenicht,
I succeeded showing a MessageBox on a specified user's display from another's(session)!
I am trying to implement a function that show specific messages on another user's UI control like a multi-line Text instead of a MessageBox, but I cannot access another user's UI, it always says "invalid thread"!
In other words, how to update another UI? could you or anyone please let me know how to solve it?
Any response would be greatly appreciated.
[Updated on: Sat, 14 December 2013 13:48] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03760 seconds