Detecting connection loss of client

79 views
Skip to first unread message

Nils

unread,
Sep 25, 2010, 3:30:44 PM9/25/10
to GWTEventService
Hi,
first of all thanks for this great library, it helped me so far alot.

Now I have a question: How do I notice on server side, that the user
lost the connection, e.g. due to a system crash?

Of course I read the chapter about "Unlisten / timeout listening" and
saw the example in the DemoConversationApp. But sadly losing the
connection / timeout is always handled only on client side.

But what I need is that this event is handled on the server.

Background:
Currently I program a small multiplayer game using GWTEventService. If
one player loses the connection, I need to handle this on server side,
by removing the player from the game (and then informing the other
client about this change), updating the score of the player etc.


Is there an easy way to do this, without changing the source code of
GWTEventService?

And is there a way to map the user session id from GWTEventService to
my internal user representation? Because of course if a client loses
its connection, I need to know to which player the client
corresponded.


Thank you.
-Nils

sven.s

unread,
Sep 25, 2010, 5:58:24 PM9/25/10
to GWTEventService
Hi,

a timeout listener (UserTimeoutListener) can be registered at the
server side to catch lost client connections. It can be registered to
the UserActivityScheduler which can be got from the UserManager
(UserManagerFactory#getInstance#getUserManager()). That was already
described here: http://groups.google.com/group/gwteventservice/browse_thread/thread/0b19af8990ab2ae8

We will improve the documentation at this point.

At the moment the using applications have to do the user mapping. You
could take a look at the DemoConversationApp, but the user mapping is
solved via an abstract event (upper class) instead of a server-side
user mapping. That is also working for lost connections because the
triggered UnlistenEvent contains the user mapping.

I hope the user mapping doesn't make many difficulties for your
application.

Regards,

Sven S.

Nils

unread,
Sep 26, 2010, 9:20:55 AM9/26/10
to GWTEventService
Hi Sven,
thanks, that was excatly what I was looking for.

Best regards
Nils

On 25 Sep., 23:58, "sven.s" <sven.strohsch...@googlemail.com> wrote:
> Hi,
>
> a timeout listener (UserTimeoutListener) can be registered at the
> server side to catch lost client connections. It can be registered to
> the UserActivityScheduler which can be got from the UserManager
> (UserManagerFactory#getInstance#getUserManager()). That was already
> described here:http://groups.google.com/group/gwteventservice/browse_thread/thread/0...
Reply all
Reply to author
Forward
0 new messages