Re: Guacd terminates connection if idle for ~30 seconds

2018-04-24 Thread Mike Jumper
On Tue, Apr 24, 2018 at 1:51 AM, messido  wrote:

> Mike Jumper wrote
> > Why are you manually invoking sendMessage()?
>
> Well i'm creating an interval to keep checking if connection is alive,
>

You do not need to do this. Ensuring keep-alive pings are sent during the
connection is an internal concern of Guacamole.Client, and the
Guacamole.Client already does this automatically. The snippet of code I
referenced earlier was not meant as a suggestion of what you need to do,
but rather to demonstrate that Guacamole.Client already takes this into
account, and that the cause of the timeout you're seeing must be something
else.

here's the code
>
> tunnel: any = new Guacamole.HTTPTunnel('tunnel');
>   guac: any  = new Guacamole.Client(this.tunnel);
>
> try {
>   this.tunnel.connect('tunnel');
>   console.log('connected tunnel');
> }catch(err){
>   console.log('error connecting to tunnel', err)
>   throw err;
> }
>

Please take a look at the tutorial in the manual, as well as the custom
webapp example included in the source:

http://guacamole.apache.org/doc/gug/writing-you-own-guacamole-app.html
https://github.com/apache/guacamole-client/tree/master/doc/guacamole-example

Though errors during connect were at one time handled synchronously, this
has not been the case since roughly 0.9.0 [1]. You will need to provide a
handler for "onerror" to programmatically deal with an error returned by
your server.

I would recommend looking into using the WebSocket tunnel, as well, at some
point (presumably chained behind the HTTPTunnel using ChainedTunnel), but
let's figure out what's wrong with your HTTP tunnel first.

Mike Jumper wrote
> > If your tunnel is returning HTTP 500, you will need to look at the
> > server-sode code of your tunnel implementation. Running it under a
> > debugger
> > may be in order.
> >
> > - Mike
>
> I'm reading the logs from guacd with DEBUG level on, nothing different is
> being thrown when calling "this.tunnel.connect(...);" vs when not calling
> it.. and the try/catch around "this.tunnel.connect" is not catching an
> error.. Should I be reading through trace or is there a better way to
> narrow
> down the issue on why tunnel.connect isn't working?
>

I'm referring here to your tunnel implementation (the class you've written
in your custom guac-powered webapp which extends
GuacamoleHTTPTunnelServlet). An HTTP 500 is returned by Tomcat, and thus by
the servlet handling the tunnel, not by guacd. If your web application is
returning an HTTP 500, you will need to debug your web application.

- Mike

[1]
https://github.com/apache/guacamole-client/commit/627271953d6eee6f49f4a385d8de62d6a0098be5


Re: Guacd terminates connection if idle for ~30 seconds

2018-04-24 Thread messido
Mike Jumper wrote
> Why are you manually invoking sendMessage()?

Well i'm creating an interval to keep checking if connection is alive,
here's the code

tunnel: any = new Guacamole.HTTPTunnel('tunnel');
  guac: any  = new Guacamole.Client(this.tunnel);

try {
  this.tunnel.connect('tunnel');
  console.log('connected tunnel');
}catch(err){
  console.log('error connecting to tunnel', err)
  throw err;
}
//ensures connection is alive
window.setInterval(() => {
  console.log('sending ping');
  this.tunnel.sendMessage('nop');
}, 5000);




Mike Jumper wrote
> If your tunnel is returning HTTP 500, you will need to look at the
> server-sode code of your tunnel implementation. Running it under a
> debugger
> may be in order.
> 
> - Mike

I'm reading the logs from guacd with DEBUG level on, nothing different is
being thrown when calling "this.tunnel.connect(...);" vs when not calling
it.. and the try/catch around "this.tunnel.connect" is not catching an
error.. Should I be reading through trace or is there a better way to narrow
down the issue on why tunnel.connect isn't working?




--
Sent from: 
http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/


Re: Guacd terminates connection if idle for ~30 seconds

2018-04-23 Thread Mike Jumper
On Mon, Apr 23, 2018, 19:47 messido  wrote:

> I'm getting error 500 when trying to run "tunnel.connect();".. what exactly
> is it expecting of the data param inside the "connect()" function?
>

It is arbitrary data, dictated only by your tunnel implementation.

The way i previous had my client being setup is
>
> guac: any  = new Guacamole.Client(new Guacamole.HTTPTunnel('tunnel'));
>
> but now since I need a tunnel in order to call the sendMessage function I
> split it into
>

Why are you manually invoking sendMessage()?

...
> so now I figured I need to "connect" the tunnel as well, in order to be
> able
> to "sendMessage".. but tunnel throws error 500 when trying to connect.. is
> it expecting the UUID or what? All the API says is "The data to send to the
> tunnel when connecting."


If your tunnel is returning HTTP 500, you will need to look at the
server-sode code of your tunnel implementation. Running it under a debugger
may be in order.

- Mike


Re: Guacd terminates connection if idle for ~30 seconds

2018-04-23 Thread messido
I'm getting error 500 when trying to run "tunnel.connect();".. what exactly
is it expecting of the data param inside the "connect()" function?

The way i previous had my client being setup is 

guac: any  = new Guacamole.Client(new Guacamole.HTTPTunnel('tunnel'));

but now since I need a tunnel in order to call the sendMessage function I
split it into

tunnel: any = new Guacamole.HTTPTunnel('tunnel'));
guac: any  = new Guacamole.Client(this.tunnel);

so now I figured I need to "connect" the tunnel as well, in order to be able
to "sendMessage".. but tunnel throws error 500 when trying to connect.. is
it expecting the UUID or what? All the API says is "The data to send to the
tunnel when connecting."

Sorry for multiple follow-up questions




--
Sent from: 
http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/


Re: Guacd terminates connection if idle for ~30 seconds

2018-04-23 Thread Mike Jumper
On Mon, Apr 23, 2018 at 4:45 PM, messido  wrote:

> Long story short; connection to host through guacd is working perfectly
> fine.. I'm using my own client to connect to guacd.. however if the "user"
> does not move the mouse/keyboard for ~30 seconds (idling) guacd will
> automatically terminate connection and log "ERROR: User is not responding".
>
> Is there a way to extend the timer? I'm assuming it's some type of session
> timeout? Even though connection is successfully created.
>
>
That timeout actually does not deal with user mouse/keyboard interaction.
On a healthy connection, the Guacamole client will be exchanging messages
back and forth with the server every few seconds. If something disrupts
that communication for 15+ seconds, then guacd will summarily close the
connection.

When you say your "own client", what are you referring to specifically? A
web application built off guacamole-common-js, etc.?

- Mike