Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
frankpacker_AoD
Contributor III
Contributor III

Attaching to WebSocket connection for mashup

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.

Labels (3)
1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

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(...);

View solution in original post

2 Replies
alex_colombo
Employee
Employee

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(...);

frankpacker_AoD
Contributor III
Contributor III
Author

Perfect. Thanks Alex!