Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

eschinea
New Contributor

Share Websocket-Browser Session

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:

::Smiley Tongueython

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!

2 Replies
lindybrits
New Contributor III

Re: Share Websocket-Browser Session

Hi Ismael

I was wondering if you ever cracked this? I want to do the same thing, but via a WebSocket connection from Node.js.

KInd Regards,

LIndy Brits.

bentotdecruz2
New Contributor

Re: Share Websocket-Browser Session

Hi Ismael,

How did you manage the login part?  Does your site has its own login page or you login in Qlik url in another tab that's why you're able to get the session?

Thanks,

Ben

Community Browser