You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by Marko Nikolić <ma...@gmail.com> on 2017/03/14 00:03:29 UTC

Connection close

Hello,

I am writing an java extension on the server side that should detect when
the connection is closed, either by using Logout or closing the browser
window.

I have found TunnelCloseEvent/Listener in the Java API, but it seems that
it is not used any more. Is there some other method for detecting
connection close event within extension?

Thanks and regards,
Marko

Re: Connection close

Posted by Mike Jumper <mi...@guac-dev.org>.
On Mon, Mar 13, 2017 at 5:03 PM, Marko Nikolić <ma...@gmail.com>
wrote:

> Hello,
>
> I am writing an java extension on the server side that should detect when
> the connection is closed, either by using Logout or closing the browser
> window.
>
> I have found TunnelCloseEvent/Listener in the Java API, but it seems that
> it is not used any more. Is there some other method for detecting
> connection close event within extension?
>
>
The place for this is within the close() function of the GuacamoleTunnel
returned by each Connection's connect() function:

http://guacamole.incubator.apache.org/doc/guacamole-common/org/apache/guacamole/net/GuacamoleTunnel.html#close--

http://guacamole.incubator.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/Connectable.html#connect-org.apache.guacamole.protocol.GuacamoleClientInformation-

That function will always be invoked when the connection has closed for any
reason.

The easiest way to do this is to override the close() function of an
existing GuacamoleTunnel implementation. Just be sure to invoke
super.close() to ensure resources are reclaimed in addition to whatever you
need to do upon closure, and that failures within your additional
functionality will not prevent those resources from being reclaimed.

- Mike