Skip to content

Instantly share code, notes, and snippets.

@mindspank
Last active March 31, 2017 11:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/d5e10b32394ee85809a5 to your computer and use it in GitHub Desktop.
Save mindspank/d5e10b32394ee85809a5 to your computer and use it in GitHub Desktop.
QES-NoProxy-Certs.js
var WebSocket = require('ws');
var fs = require('fs');
var ws = new WebSocket('wss://usrad-akl:4747/app/', {
origin: 'https://usrad-akl', // <- This origin has to be in the WebSocket White list of Qlik Sense
cert: fs.readFileSync(__dirname + '/client.pem'),
key: fs.readFileSync(__dirname + '/client_key.pem'),
headers: {
'X-Qlik-User': 'UserDirectory=Internal;UserId=sa_repository' // Passing a user to QIX to authenticate as
},
rejectUnauthorized: false
});
ws.on('open', function open() {
var message = {
"jsonrpc": "2.0",
"id": 2,
"method": "ProductVersion",
"handle": -1,
"params": []
};
ws.send(JSON.stringify(message));
});
ws.on('message', function(data, flags) {
console.log(data);
});
ws.on('error', function(error) {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment