0 Replies Latest reply: Apr 25, 2018 5:15 AM by Ismael Chinea RSS

    Share Websocket-Browser Session

    Ismael Chinea

      Hi,

       

      Due to business requirements I need to connect a website to QlikSense Enterprise so users can select values either directly on Qlik or from that site. So far, I have connected QlikSense Enterprise to that website via Python and Websocket. So something similar to this:

      Qlik - (Websocket) Python (API) - Site

       

      My problem is that when python connects to Qlik via Websocket I get a new session even though the user has already an open session (Qlik opened on browser). Message from Qlik:

      {"jsonrpc":"2.0","method":"OnConnected","params":{"qSessionState":"SESSION_CREATED"}}

       

      This means that every modification the user makes via websocket will not be visible on the browser (different sessions). I have tried and read everything I could but I haven't found the way to create/share only one session per user, so all changes the user makes via the browser or websocket would be available to him.

       

      I think one option could be sharing X-Qlik-Session cookie, but I have not succeed on this so far.

       

      This is how I am opening the websocket connection:

      :::python

      self.ws = websocket.WebSocketApp(self.url, on_message=self.on_message, on_error=self.on_error, on_close=self.on_close, header={'X-Qlik-User: UserDirectory=XYZ; UserId=xyz'})

      ssl_option = ({"ca_certs": "\\root.pem",
         "certfile": "\\client.pem",
         "keyfile": "\\client_key.pem",
         "cert_reqs": ssl.CERT_NONE,
         "server_side": False
         })
      self.ws.on_open = self.on_open

      self.ws.run_forever(sslopt=ssl_option)

       

      I'd appreciate any help or hint on this.

      Thanks in advance!