Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

WebSocket session closed when calling QRS API

Hi,

I just noticed that something interesting when using Engine API and QRS API together.

Here's the scenario:

- open WebSocket session for Engine API calls (using Java & Tyrus WS implementation)

- call some Engine API method

- make a QRS API call

--> WebSocket session closes just after this !?!? (subsequent Engine API calls will fail)

If I leave out QRS API call, the WS session stays open normally ofc.

Is Qlik closing the WS session when executing the QRS API call?

This feels a bit strange to me. Anyone else has encountered this?

1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: WebSocket session closed when calling QRS API

The session is closed by design. If you would reuse the same session for another app you would break the load balancing. You should always open a new session when you open an app, to allow the load balancer to direct you to the correct engine.

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
6 Replies
Not applicable

Re: WebSocket session closed when calling QRS API

Just a quick update:

This seems to be the case only if we delete an app via QRS API that we have been creating via Engine API call.

So an improved description of events is as follows:

- open WebSocket session for Engine API calls (using Java & Tyrus WS implementation)

- call "CreateApp" Engine API method

- call "OpenDoc" Engine API method (get handle to created app)

- make a QRS API call (DELETE qrs/app/{id}) (delete the created app)

--> WebSocket session closes just after this (subsequent Engine API calls will fail)

Employee
Employee

Re: WebSocket session closed when calling QRS API

Are you deleting the same app that you have just opened? Your WebSocket session will be tied to the app you are connecting to, so if the app is deleted, then it is expected that your WebSocket should close as well. But if you have a WebSocket connection to the hub or another app, then that should remain unaffected.

Not applicable

Re: WebSocket session closed when calling QRS API

Yes it is the same app we're deleting. It is used for temporary purposes.

It's a bit shame that it's closing the session in this scenario, I mean one might guess you could do other things that are not related to that app in the same session later on, right?

Ok but anyway, thanks for the answer and I'll refactor our code and move things around to avoid this situation.

erik_wetterberg
Honored Contributor

Re: WebSocket session closed when calling QRS API

The session is closed by design. If you would reuse the same session for another app you would break the load balancing. You should always open a new session when you open an app, to allow the load balancer to direct you to the correct engine.

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: WebSocket session closed when calling QRS API

Ok thanks Erik.

Not applicable

Re: WebSocket session closed when calling QRS API

Hi Tony,

I just that you succeed to connect to Engine API from java using Tyrus WS implemantation.

I'm trying the same thing, but I still have a problem to authenticate my first call (GetDocList).

It return me this : {"jsonrpc":"2.0","method":"OnAuthenticationInformation","params":{"loginUri":"http://qlik:4248/form/?targetId=d73c82b6-3ed6-457f-976b-8729cc89cd80","mustAuthenticate":true}}

Can you help me ?

I try with a qlikTicket and with an another virtual proxy throw static header authentication.

Thank you

Eric