Qlik core hello engine
by Wuzhong Zhu
HTML
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<style>
</style>
</head>
<body>
<h1 id="title">Qlik Core + Enigma example 1</h1>
<h2 id="subtitle">Connect to engine</h2>
<p id ="description">An example of initiating connection with qlik core. Just a fiddle version of the <a href="https://core.qlik.com/tutorials/hello-engine/">hello-engine example</a></p>
<p id ="hashtags">#qlikcore #enigma</p>
<br>
<p id="msg">trying to connect</p>
<script src="https://unpkg.com/enigma.js"></script>
<script src="https://unpkg.com/jquery"></script>
</body>
</html>
JavaScript
//First, get schema for enigma 2.2.0
$.get('https://unpkg.com/enigma.js@2.2.0/schemas/12.34.11.json')
.then(schema => {
//Created a session connected to qlik core
const session = enigma.create({
schema,
url: "ws://ec2-18-218-199-158.us-east-2.compute.amazonaws.com:19076",
createSocket: url => new WebSocket(url)
});
session.open()
.then(global => {
return global.engineVersion();
})
.then(app => {
$("#msg").text(`Engine version retrieved: ${app.qComponentVersion}`);
})
})