<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proxy and Engine sessions in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Proxy-and-Engine-sessions/m-p/1915858#M16582</link>
    <description>&lt;P&gt;Hi there, I still have some doubts concerning proxy and engine sessions.&lt;/P&gt;
&lt;P&gt;Question#1: I know they are different, but are they related?&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const session = enigma.create({
  schema,
  url: `wss://${engineHost}:${enginePort}/app/${appId}`,
  createSocket: (url) =&amp;gt; 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) =&amp;gt; {
	console.log(`Session was opened successfully for app ${appId}`);
	console.log(session.id);
	
	global.openDoc(
		`${appId}`
	)
	.then( (app) =&amp;gt; {
		//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) =&amp;gt; {
		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) =&amp;gt; {
	console.log('An error occurred while opening Qlik Sense Engine session:', error);
	process.exit(1);
});&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 07 Apr 2022 13:24:01 GMT</pubDate>
    <dc:creator>AG-gugelbisolutions</dc:creator>
    <dc:date>2022-04-07T13:24:01Z</dc:date>
    <item>
      <title>Proxy and Engine sessions</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Proxy-and-Engine-sessions/m-p/1915858#M16582</link>
      <description>&lt;P&gt;Hi there, I still have some doubts concerning proxy and engine sessions.&lt;/P&gt;
&lt;P&gt;Question#1: I know they are different, but are they related?&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const session = enigma.create({
  schema,
  url: `wss://${engineHost}:${enginePort}/app/${appId}`,
  createSocket: (url) =&amp;gt; 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) =&amp;gt; {
	console.log(`Session was opened successfully for app ${appId}`);
	console.log(session.id);
	
	global.openDoc(
		`${appId}`
	)
	.then( (app) =&amp;gt; {
		//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) =&amp;gt; {
		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) =&amp;gt; {
	console.log('An error occurred while opening Qlik Sense Engine session:', error);
	process.exit(1);
});&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 13:24:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Proxy-and-Engine-sessions/m-p/1915858#M16582</guid>
      <dc:creator>AG-gugelbisolutions</dc:creator>
      <dc:date>2022-04-07T13:24:01Z</dc:date>
    </item>
  </channel>
</rss>

