5 Replies Latest reply: Jun 28, 2018 9:31 AM by Gabi Nea RSS

    Node JS WebSocket error

    Gabi Nea

      Hi guys!

       

      I'm trying to crate a custom login for my mashup and I'm using NodeJS as a server running on port 3000.

      I have created a virtual proxy, whitelisted the domains and set the Access Control Allow Origin to *.


      I'm using ticket authentication following the idea posted by Alexander here:

      Process

      1. Browser requests ticket from server component.

      2. Server component issues ticket to user/browser

      3. Browser consumes ticket by requesting https://<your QS server>/resources/img/dark_noise_16x16.png?qlikTicket=<yourticket>

      4. QS Server returns the image and a Set Cookie header.

      5. Discard the image and just load the qlik.js API

       

       

      My virtual proxy name is "login". After I use the custom NodeJS login page and I successfully login, NodeJS redirects me to my extension, but I'm also able to access:

      1. http://myserver/login/extensions/myextension

      2. http://myserver/login/hub

      3. http://myserver/login/qmc

       

      However, when I try to display a QlikSense object using DIV integration in a Node JS page I encounter a websocket error.

      I am able to load all the js/css dependencies (require.js, qlik.js, etc.), but I am unable to display de QS object.

       

      The usual qlik.openApp(..,...) function is trying to access this link: ws://myserver:3000/login, instead of ws://myserver/login and this is the error that I receive:


      WebSocket connection to 'ws://myserver:3000/login/app/adb96e4a-ba87-40d3-8f1f-17892109b29c?reloadUri=http%3A%2F%2Fmyserver%3A3000%2Ftest.html' failed: Connection closed before receiving a handshake response


      I tried editing the require config, removing the port, but still the openApp function is adding port 3000, even though I remove it from the config variable.


      var config = {

      host: window.location.hostname,

      prefix: '/login/',

      // port: window.location.port,

      isSecure: window.location.protocol === "https:"

      };

       

      I edited even the baseUrl like this:

       

      baseUrl: (config.isSecure ? "https://" : "http://") + config.host + config.prefix + "resources",


      I have whitelisted the server address, server ip address, server address:3000, server ip address:3000, but still the websocket handshake error persists.

       

      Screen Shot 2018-06-26 at 6.24.35 PM.png

       

      Screen Shot 2018-06-26 at 6.24.49 PM.png

       

      Screen Shot 2018-06-26 at 6.24.58 PM.png

       

      Could you guys point me in the right direction, or maybe suggest another route to follow in order to integrate QS objects in external webpages?