I'm trying to do a web-socket connection, but it's not working with
chrome(works in firefox). It might be my own issue, which Is why I did set
this to be a bug. I get this in response:

guacamole.js?compile=false:10040 WebSocket connection to
'ws://localhost:####/********/guacamole/websocket?port=####&password=*******&host=******'
failed: Error during WebSocket handshake: Sent non-empty
'Sec-WebSocket-Protocol' header but no response was received

I've seen people say that I have to set "subprotocol: 'base46', but I'm not
sure where I would set that for the web-socket, as that seems to be created
within guac somewhere.

My current set-up in Grails3/SpringBoot is:

@ServerEndpoint("/guacamole/websocket")

class EndpointConfig extends GuacamoleWebSocketTunnelEndpoint
implements ServletContextListener {



    @Override

    void contextInitialized(ServletContextEvent sce) {

        ServletContext servletContext = sce.servletContext

        ServerContainer serverContainer =
servletContext.getAttribute("javax.websocket.server.ServerContainer")



        try {

            // This is necessary for Grails to add the endpoint in development.

            // In production, the endpoint will be added by the @ServerEndpoint

            // annotation.

            if (Environment.current == Environment.DEVELOPMENT) {

                serverContainer.addEndpoint(EndpointConfig)

            }

            serverContainer.defaultMaxSessionIdleTimeout = 0

        } catch (IOException e) {

            log.error(e.message, e)

        }

    }



    @Override

    void contextDestroyed(ServletContextEvent sce) {



    }



    @Override

    protected GuacamoleTunnel createTunnel(Session session,
javax.websocket.EndpointConfig config) throws GuacamoleException {

        // Create our configuration TODO change for security after POC

        GuacamoleConfiguration guacConfig = new GuacamoleConfiguration()

        guacConfig.setProtocol("vnc")

        guacConfig.setParameter("hostname", session.requestParameterMap.host[0])

        guacConfig.setParameter("port", session.requestParameterMap.port[0])

        guacConfig.setParameter("password",
session.requestParameterMap.password[0])



        GuacamoleSocket socket = new ConfiguredGuacamoleSocket(new
InetGuacamoleSocket("localhost", ####), guacConfig)



        // Return a new tunnel which uses the connected socket

        return new SimpleGuacamoleTunnel(socket)

    }

}

I've looked at the sample client, but that is very tightly coupled into
it's own implementation, so I'm not sure if there is something I could take
from it.

Thank you for reading, and any help you might be able to provide

Reply via email to