Connection close

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Connection close

Marko Nikolić
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
Reply | Threaded
Open this post in threaded view
|

Re: Connection close

Mike Jumper
On Mon, Mar 13, 2017 at 5:03 PM, Marko Nikolić <[hidden email]> 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:



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