gwt-comet and multiple windows/tabs

182 views
Skip to first unread message

Jayd3e

unread,
Jun 9, 2011, 5:18:03 PM6/9/11
to gwt-comet
I know this is on the roadmap, but I wanted to ask if this is even
possible. I am working on a project that requires a user to be able
to open up multiple windows/tabs, that have different instances of the
same gwt interface. Is it even possible to make it so different
cometSessions can exist in each of these tabs/windows? If I can't
have an individual cometSession for each window/tab, then can I hack
my application to use the same session, but support multiple
instances?

Thanks in advance,
Joe D.

Icky

unread,
Jun 9, 2011, 11:10:54 PM6/9/11
to gwt-comet
Hi Jaydee,

I think it is possible, but I think what I do is closer to a
workaround rather than a solution. nevertheless this is what I do:

1) I don't use comet session, I use cometResponse explicitly.
2) Each new browser tab/window is allocated an ID.
3) When connect to CometServlet I save their cometResponse against
that ID
4) When they subscribe/unsusbcribe, I store all subscriptions against
the ID
5) Then when server need to push, it retrieves the saved cometResponse
associated with the ID and queue messages to it.

This ends up allowing each window/tab to have its own Comet
subscriptions and response.

Regards,
Icky

Joe Dallago

unread,
Jun 10, 2011, 11:42:22 AM6/10/11
to gwt-...@googlegroups.com
Ok this is very helpful, thank you. I am interested in hearing any
CometSession specific solutions if possible, b/c I would prefer not to
completely scrap all of my existing code.

Joe Dallago

unread,
Jun 10, 2011, 11:42:50 AM6/10/11
to gwt-...@googlegroups.com
That is, if they exist.

Richard Zschech

unread,
Jun 26, 2011, 8:15:18 PM6/26/11
to gwt-comet
Hi Joe,

Icky is correct not using the comet session works.

It has been on the cards to implement for a while but I've not been
able to allocate much time to gwt-comet :-(

A simple possibility would be to change
CometServlet.getCometSession(...) to take the HttpServletRequest which
you could add a "new connection" parameter too. When the "new
connection" parameter is set then rather than looking up the
CometSession from the HttpSession basked on
CometSession.HTTP_SESSION_KEY you could generate a connection id and
do the HttpSession mapping based on that. You could then return the
connection id back to the client which could use it for subsequent
requests.

This is different to my initial plans which was to share a single
comet connection amongst multiple windows, where the client side code
would do the work of distributing the message to the right window
(which is a lot more work).

From Richard.

On Jun 11, 12:42 am, Joe Dallago <jd.dall...@gmail.com> wrote:
> That is, if they exist.
>
>
>
>
>
>
>
> On Fri, Jun 10, 2011 at 10:42 AM, Joe Dallago <jd.dall...@gmail.com> wrote:
> > Ok this is very helpful, thank you.  I am interested in hearing any
> > CometSession specific solutions if possible, b/c I would prefer not to
> > completely scrap all of my existing code.
>

Emil Daoura

unread,
Oct 10, 2012, 5:46:34 AM10/10/12
to gwt-...@googlegroups.com
Hi Jaydee,

your solution seems to be interested.
please can you send me an example of such solution.

I don't know how to do the 3 till 5.

thanks.
Emil
Reply all
Reply to author
Forward
0 new messages