Hi,
I'm adding WebSocket support to my Guacamole-driven application.
Mike suggested me to use GuacamoleWebSocketTunnelEndpoint. For now I'm
creating a simple tutorial to achieve this.
My simple client (index.html) looks like this
...
// Get display div from document
var display = document.getElementById("display");
// Instantiate tunnel, using a WebSocket or HTTP tunnel for
communications.
var tunnel;
if (window.WebSocket) {
// If WebSocket available, try to use it.
tunnel = new Guacamole.ChainedTunnel(
new Guacamole.WebSocketTunnel('websocket-tunnel'),
new Guacamole.HTTPTunnel('tunnel') );
} else {
// If not, then use HTTP tunnel.
tunnel = new Guacamole.HTTPTunnel('tunnel');
}
// Instantiate client.
var client = new Guacamole.Client(tunnel);
// Add client to display div
display.appendChild(client.getDisplay().getElement());
// Error handler
client.onerror = function(error) {
alert(error);
};
// Connect
client.connect();
...
And my GuacamoleWebSocketTunnelEndpoint implementation looks like this. Which
does nothing but log in Catalina.out.
public class TutorialGuacamoleWebSocketTunnelEndpoint
extends GuacamoleWebSocketTunnelEndpoint {
@Override
protected GuacamoleTunnel createTunnel(Session session, EndpointConfig
config)
throws GuacamoleException {
System.out.println("Using WebSocket connection.");
// Return a new guacamole tunnel which uses the connected socket
return null;
}
}
My issue is the following.
I'm getting an WebSocket Handshare error, which could be ok because of my dummy
implementation, but I'm not getting any output in Catalina.out. Which make me
think that there is something wrong in my client. My Implementation of
GuacamoleWebSocketTunnelEndpoint in not even called.
--> WebSocket connection to 'wss://.../tutorial/websocket-tunnel?...' failed:
Error during WebSocket handshake: Unexpected response code: 404
Any help will be appreciated.
Thanks,
Bruno Savard