Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Looking for some tips on how I can get hold of the WebSocket connection that Qlik establishes in a mashup so that I can use it to communicate with the JSON API - specifically, I need to use the CreateBookmarkEx method, since it saves layout where the ordinary method does not.
I have two different deployments with the same need. One is a 'traditional' mashup that imports js/qlik using RequireJS and sets up the 'qlik' object containing the WebSocket and the other is using EnigmaJS, which creates the Enigma 'session' object. Both of these have the WebSocket connection within them, and I just need to get hold of that so that I can execute and listen to responses for the sorts of commands like those detailed here
I can set up a separate WebSocket connection, and this works to an extent, but when fetched, the doc has a new handle and as such things like selections in bookmarks etc are not dealt with correctly.
Hoping someone knows a way to get hold of the underlying WebSocket connection and make use of it like any other JavaScript WebSocket.
Hey @frankpacker_AoD you can leverage the websocket created by Capability APIs and requireJS. Capability APIs are a wrapper on top of Engine APIs and you can access them using qlik.qlikApp.model.enigmaModel. Below and example of accessing it, remember to wait promise from enigmaModel, this is telling you when Engine APIs are ready to be used.
await qlikApp.model.enigmaModel.waitForOpen.promise;
const bookmark = await qlikApp.model.enigmaModel.createBookmarkEx(...);
Hey @frankpacker_AoD you can leverage the websocket created by Capability APIs and requireJS. Capability APIs are a wrapper on top of Engine APIs and you can access them using qlik.qlikApp.model.enigmaModel. Below and example of accessing it, remember to wait promise from enigmaModel, this is telling you when Engine APIs are ready to be used.
await qlikApp.model.enigmaModel.waitForOpen.promise;
const bookmark = await qlikApp.model.enigmaModel.createBookmarkEx(...);
Perfect. Thanks Alex!