Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Closing QlikSense applications via the Capability Root API

I have a Qlik Sense mashup that opens several Qlik Sense applications via the Root API.  The key is that a websocket created/opened in the browser for each opened application.  Here's some background:

  1. The mashup will initially get a list of apps via the getAppList call (Capability API/Root API).
  2. Then based on mashup UI needs, I'll look up each app I need to open, by name, from the list of available apps.
  3. Once I've opened an application (openApp(id, config) - Capability API/Root API), I add the resulting app instance to a connectedApp array.  (So, if I need to interact with the same application again, I look first in the connectedApp array for it and if not found, I open it & add it to the array.)

As users navigate the mashup website, previously opened apps may no longer be needed (I know what apps are referenced as the route state is resolved) so I'd like to clean up websockets by closing the unused applications.  However, when I do so, I receive qlik.js exceptions after the fact, even though I KNOW the apps aren't needed. I call clearAll(true) - yep, I wait for the promise - followed by close().  The exception, which unfortunately I don't have handy, related to a promise, so I imagine there was a call on the closed app, that was supposed to return a promise, but the target of the promise call was null or undefined.

Is there a preferred way to clean up application objects so that websocket counts are minimized?  Can I query a Qlik API to determine # of open websockets?  Can I query a Qlik API to retrieve the collection of open websockets?  Anything else that might be helpful?  If you need the exact exception I can create a sample mashup that toggles between 2 routes, and have each route open a couple of mutually exclusive apps, and close the other unused apps.

This is a website requirement for us in terms of the Internet Explorer default maximum of 6 concurrent websocket connections.  We encourage use of Chrome, but need to support IE as well.

Thanks!

3 Replies
ErikWetterberg

Hi,

You shouldn't need the clearAll call, in fact it might invalidate objects and lead to extra calls. Try removing that. I don't think there is and API to checka for open sockets.

Hope this helps

Erik Wetterberg

Anonymous
Not applicable
Author

We do apply filters to the apps in our mashup using the APIs... Still okay to close without the clear?  Thanks!

ErikWetterberg

Sure, clearAll only clears selections, which will be lost when you close anyhow.

Erik Wetterberg