<?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 Enigma.js in mashup - issues with loading schema in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727272#M13010</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use enigma.js to access the Engine API from within a mashup, but am having an issue when trying to specify the schema.&lt;/P&gt;&lt;P&gt;Following the instructions from here&amp;nbsp;&lt;A href="https://github.com/qlik-oss/enigma.js/blob/master/docs/api.md#enigmacreateconfig" target="_blank" rel="noopener"&gt;https://github.com/qlik-oss/enigma.js/blob/master/docs/api.md#enigmacreateconfig&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I add the line:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const schema = require('../enigma/schemas/12.170.2.json');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;but I get an error message in the console:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enigma schema error.JPG" style="width: 831px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/37353i1E01E209E079162B/image-size/large?v=v2&amp;amp;px=999" role="button" title="enigma schema error.JPG" alt="enigma schema error.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I know that the json file is accessible as I can access it directly through my browser, so does anyone have any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:55:18 GMT</pubDate>
    <dc:creator>rbartley2</dc:creator>
    <dc:date>2024-11-16T01:55:18Z</dc:date>
    <item>
      <title>Enigma.js in mashup - issues with loading schema</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727272#M13010</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use enigma.js to access the Engine API from within a mashup, but am having an issue when trying to specify the schema.&lt;/P&gt;&lt;P&gt;Following the instructions from here&amp;nbsp;&lt;A href="https://github.com/qlik-oss/enigma.js/blob/master/docs/api.md#enigmacreateconfig" target="_blank" rel="noopener"&gt;https://github.com/qlik-oss/enigma.js/blob/master/docs/api.md#enigmacreateconfig&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I add the line:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const schema = require('../enigma/schemas/12.170.2.json');&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;but I get an error message in the console:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enigma schema error.JPG" style="width: 831px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/37353i1E01E209E079162B/image-size/large?v=v2&amp;amp;px=999" role="button" title="enigma schema error.JPG" alt="enigma schema error.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I know that the json file is accessible as I can access it directly through my browser, so does anyone have any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:55:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727272#M13010</guid>
      <dc:creator>rbartley2</dc:creator>
      <dc:date>2024-11-16T01:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Enigma.js in mashup - issues with loading schema</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727275#M13012</link>
      <description>&lt;P&gt;You are using a relative path in your require ('../enigma....)&lt;BR /&gt;&lt;BR /&gt;That would reference from your javascript file that defining the require&lt;/P&gt;&lt;P&gt;Try using a reference to the enigma.js module instead&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="pl-s"&gt;'enigma.js/schemas/12.170.2.json'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 11:37:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727275#M13012</guid>
      <dc:creator>han</dc:creator>
      <dc:date>2020-07-13T11:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Enigma.js in mashup - issues with loading schema</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727279#M13013</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for responding.&amp;nbsp; Unfortunately, I get a similar message (only the reference is different):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enigma schema error2.JPG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/37355iD3A76247FF9DA9D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="enigma schema error2.JPG" alt="enigma schema error2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 11:42:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727279#M13013</guid>
      <dc:creator>rbartley2</dc:creator>
      <dc:date>2020-07-13T11:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Enigma.js in mashup - issues with loading schema</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727288#M13014</link>
      <description>&lt;P&gt;If you are using requirejs you need to make sure you wait unitil the json file is loaded. Assuming you already have a require call off the format:&lt;/P&gt;&lt;P&gt;require([....], function( x, a y){&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; //lots of code here&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;you could add the schema to the dependency array.&lt;/P&gt;&lt;P&gt;You could also use fetch:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;fetch('&lt;A href="https://unpkg.com/enigma.js/schemas/x.x.json" target="_blank"&gt;https://unpkg.com/enigma.js/schemas/x.x.json&lt;/A&gt;').&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;then(response&amp;nbsp;=&amp;gt;&amp;nbsp;response.json()).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;then(schema&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:00:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1727288#M13014</guid>
      <dc:creator>ErikWetterberg</dc:creator>
      <dc:date>2020-07-13T12:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Enigma.js in mashup - issues with loading schema</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1728162#M13022</link>
      <description>&lt;P&gt;Hi Erik,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this. fetch() worked for me and I can now use Enigma.js to open an app.&amp;nbsp; For anyone interested, here's the code I used.&amp;nbsp; I will continue to work on this to fulfil my requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$( document ).ready(function()
{
	...
	...
	 
	 var config = {
					host:window.location.hostname,
					port: 82
					};
	require.config( {
						baseUrl: (config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "" ) + config.prefix
					} );
	
	
	schemaLocation = "http://"+config.host + (config.port ? ":" + config.port : "" )+"/enigma/schemas/12.170.2.json";
	console.log('schemaLocation',schemaLocation);
	fetch(schemaLocation).then(response =&amp;gt; response.json()).then(function(schema)
	{
		
		prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
	
		var config = {
					host: window.location.hostname,
					prefix: prefix,
					port: 82,
					isSecure: window.location.protocol === "https:"
					,identity:strIdentity
			};
			
			require.config( {
				baseUrl: (config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "" ) + config.prefix
			} );
		
		require(['enigma/enigma'],function(enigma)
		{
			
			var config = {
					host: window.location.hostname,
					prefix: prefix,
					port: window.location.port,
					isSecure: window.location.protocol === "https:"
					,identity:strIdentity
			};
			
			require.config( {
				baseUrl: (config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "" ) + config.prefix + "resources"
			} );
			
			require( ['js/qlik'], function ( qlik ) 
			{
				var config = {
					  schema: schema,
					  url: 'ws://s-agri-qaptest1/app/engineData',
					   createSocket: url =&amp;gt; new WebSocket(url),
					  suspendOnClose: true,
					  protocol: { delta: false },
					};
				
				
				const session = enigma.create(config).open().then(function(global)
				{
					var app = qlik.openApp('4d791990-c8c5-4766-b5ea-e73d36ef7358',config);
				});
			});
		});	
	});
	
});
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Jul 2020 18:21:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Enigma-js-in-mashup-issues-with-loading-schema/m-p/1728162#M13022</guid>
      <dc:creator>rbartley2</dc:creator>
      <dc:date>2020-07-15T18:21:15Z</dc:date>
    </item>
  </channel>
</rss>

