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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
AG-gugelbisolutions
Creator II
Creator II

Proxy and Engine sessions

Hi there, I still have some doubts concerning proxy and engine sessions.

Question#1: I know they are different, but are they related?

Question #2: I'm playing around with Engine JSON API and it seems like I'm always creating or getting attached to the same session (ID = 1), even though a changed user and app ID; what am I getting wrong?

const session = enigma.create({
  schema,
  url: `wss://${engineHost}:${enginePort}/app/${appId}`,
  createSocket: (url) => new WebSocket(url, {
    ca: [readCert('root.pem')],
    key: readCert('client_key.pem'),
    cert: readCert('client.pem'),
	servername: 'ourServerName',
    headers: {
      'X-Qlik-User': `UserDirectory=${encodeURIComponent(userDirectory)}; UserId=${encodeURIComponent(userId)}`,
    },
  }),
});

//console.log(session);
//console.log(appId);

session.open().then((global) => {
	console.log(`Session was opened successfully for app ${appId}`);
	console.log(session.id);
	
	global.openDoc(
		`${appId}`
	)
	.then( (app) => {
		//console.log('App %d was open',app.qGenericId);
		console.log(`Opened app ${app.id}`);
		console.log(global.GetAuthenticatedUser());
		app.session.close();
		console.log(`Session was closed for app ${appId}`);
	})
	.catch( (error) => {
		if( error.message.includes("App already open") ) {
			console.log('INFO: the app is already open');
		} else {
			console.log('An error occurred while opening Qlik Sense app %d:','`${appId}`', error);
			process.exit(1);
		}
	})
	;

}).catch((error) => {
	console.log('An error occurred while opening Qlik Sense Engine session:', error);
	process.exit(1);
});
Labels (1)
  • API

0 Replies