Alex K.
Alex K.

Reputation: 3304

GWT event servise browsers synchronization problem

I have implemented pretty simple application, using gwt and gwt event service 1.1.1, it sends some information to the server and waits for particular event to come back.

When application is opened in one browser window, it works fine.

When it is opened in two browser windows (the same browser and the same address: localhost:port/app or ip:port/app) on one machine, only one instance of my application receives event (UI reflects changes only in one window).

When it is opened in two different browsers, but with the same addresses (for instance, both are localhost:port/app), then both browsers receive events.

When it is opened in two windows of the same browser, but with different addresses (one is localhost:port/app, second is ip:port/app), then it also receives events.

So, could somebody provide any explanation to such behavior? And if is there some kind of workaround for this problem.

Thanks in advance, Alex.

Upvotes: 0

Views: 894

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

You are using gwt event service on the server, right?

They claim to have "Only one open connection for event listening". So they actively check that one client has only one connection for sending events. They probably use web sessions to achieve this.

Since you open the same URL in the same browses in two tabs, this two tabs share the same session. There is no way around it. There are a lot of questions about this: https://stackoverflow.com/search?q=browser+tabs+session

Update:

It seems that gwt-event-service can be configured to support multiple sessions: use SessionExtendedConnectionIdGenerator

Update 2:

Use a config file like this: http://code.google.com/p/gwteventservice/source/browse/trunk/conf/eventservice.properties?r=265

Upvotes: 4

Related Questions