padarom / guacamole-common-js

:avocado: The JavaScript Guacamole client library modified for easy installation and usage via npm
http://guac-dev.org/
Apache License 2.0
41 stars 19 forks source link

Parameter "GUAC_ID" is required. #31

Closed lmeullibre closed 8 months ago

lmeullibre commented 8 months ago

Hi! I keep receiving this error from my docker guacamole logs. ERROR o.a.g.w.GuacamoleWebSocketTunnelEndpoint - Creation of WebSocket tunnel to guacd failed: Parameter "GUAC_ID" is required. After doing some research I came up to the conclusion I'm doing something wrong on the client. Any suggestion? Thank you so much!

  function initializeGuacamoleClient() {

    var tunnel = new Guacamole.WebSocketTunnel(
      "ws://[virtualmachineaddress]:8080/guacamole/websocket-tunnel"
    );

    guacClient = new Guacamole.Client(tunnel);

    if (displayContainer) {
      displayContainer.appendChild(guacClient.getDisplay().getElement());
      displayContainer.style.display = "block";
      guacClient.connect("username=guacadmin&password=guacadmin");
    }
  }
Ani-21 commented 8 months ago

Try to connect your client through Node.js application to manage the session and forward messages via WebSocket.

Try to use this library: https://github.com/vadimpronin/guacamole-lite

lmeullibre commented 8 months ago

Hi @Ani-21, thanks for your response. I actually fixed it by passing these parameters to guacamoleClient.connect():

  guacamoleClient.connect(
      `token=${token}&GUAC_ID=1&GUAC_TYPE=c&GUAC_DATA_SOURCE=mysql`
    );

Being GUAC_ID the id of the connection where I want to connect. Thank you!