Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
dionverbeke
Luminary Alumni
Luminary Alumni

selectAll of a field with enigma. it works, but does not change across devices

Hi,

I created a node.js application which kindof works.

It outputs that it has selected the field, but I do not see it changing in my app.

How to make sure I am using exactly the same session as the app I am seeing?

....

var http = require('http');

const enigma = require('enigma.js');

const WebSocket = require('ws');

const path = require('path');

const fs = require('fs');

var promise = require('bluebird');

const schema = require('enigma.js/schemas/12.67.2.json');

const certificatesPath = `./`;

const readCert = filename => fs.readFileSync(path.resolve(__dirname, certificatesPath, filename));

const userDirectory = 'demo';

const userId = 'demo';

const senseHost = 'localhost';

const enginePort = 4747;

//d494ab72-fb06-4bc2-9de8-2b52e0c73b67

  var session = createSession();

//'X-Qlik-User': `UserDirectory=${encodeURIComponent(userDirectory)}; UserId=${encodeURIComponent(userId)}`,

function createSession() {

const requestOptions = {

           ca: [readCert('root.pem')],

           key: readCert('client_key.pem'),

           cert: readCert('client.pem'),

             headers: {

   'x-qlik-xrfkey' : 'abcdefghijklmnop',

'X-Qlik-User': `UserDirectory=${encodeURIComponent(userDirectory)}; UserId=${encodeURIComponent(userId)}`,

           },

           rejectUnauthorized: false

       };

const firstAppId = 'f4dc174f-2f9e-49ef-83f9-6c6869f1dc09';

    return enigma.create({

    schema,

    // We use the configured proxyPrefix here to make sure Sense uses the correct

    // authentication:

    url: `wss://localhost:4747`,

    // Please notice the requestOptions parameter when creating the websocket:

    createSocket: url => new WebSocket(url, requestOptions),

  }).open().then(global => global.openDoc(firstAppId)).then((app) => {

    console.log(`Opened app ${app.id}`);

return app.getField('ReportingCountry.JurisdictionName').then((f) => {

return f.selectAll().then((g) => {

console.log('selectAll',g);

return app.session.close();

}).catch((err) => {

                            console.log("There was an error @getScript" + err);

                        });

 

}).catch((err) => {

                console.log("There was an error @getScript" + err);

            });

  })

  .catch((err) => {

        console.log("There was an error @getScript" + err);

});

}

5 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Desktop or Enterprise?  Session sharing doesn't work in Desktop.

-Rob

dionverbeke
Luminary Alumni
Luminary Alumni
Author

Enterprise April 2018.

Funny thing is that the Engine Explorer works...

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Is your other app a mashup that is also authenticating with certs?

dionverbeke
Luminary Alumni
Luminary Alumni
Author

No it is an app in the hub authenticating via windows authentication.

There is however a reverse proxy inbetween. that maps 443 -> 8443.

As said the engine explorer works and makes the change visible.

My version is executing, but not making the change visible.

I *assume* it is because they are not talking to the same session.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I believe different auth mechanism will always equal different session.  You might confirm that over on the slack channel.

The engine explorer works because it too is using NTLM auth.

-Rob