@magic-xpa/engine 4.1300.0-dev4130.177 → 4.1300.0-dev4130.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -609,6 +609,7 @@ class ConstInterface {
|
|
|
609
609
|
static RC_TOKEN_CACHED_FILE = "CACHE=";
|
|
610
610
|
//For PuSub
|
|
611
611
|
static MG_TAG_PUBSUB_SERVER_URI = "PubSubServerURI";
|
|
612
|
+
static WC_TOKEN_PUBSUB_SUBSCRIBE = "PubsubToken=Y&";
|
|
612
613
|
}
|
|
613
614
|
|
|
614
615
|
/// <summary>
|
|
@@ -7808,6 +7809,23 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
|
7808
7809
|
await AccessHelper.mgDataTable.processRecovery();
|
|
7809
7810
|
AccessHelper.eventsManager.popNewExecStacks();
|
|
7810
7811
|
}
|
|
7812
|
+
// <summary> Get the subscription token from server </summary>
|
|
7813
|
+
// <param name="topics">List of topics to be subscribed to.</param>
|
|
7814
|
+
// <returns> Return subscription token to authenticate xpa client </returns>
|
|
7815
|
+
async GetSubscriptionTokenFromServer(topics) {
|
|
7816
|
+
const sessionID = this.SessionId;
|
|
7817
|
+
let queryStr = `${ConstInterface.REQ_ARG_START}${ConstInterface.RC_INDICATION}${ConstInterface.RC_TOKEN_CTX_ID}${ClientManager.Instance.GetRuntimeCtxID()}`;
|
|
7818
|
+
if (!isNullOrUndefined(sessionID))
|
|
7819
|
+
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_ID}${sessionID}`;
|
|
7820
|
+
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.WC_TOKEN_PUBSUB_SUBSCRIBE}`;
|
|
7821
|
+
//queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_TARGET_FILE}`;
|
|
7822
|
+
const url = ServerConfig.Instance.getServerURL() + queryStr;
|
|
7823
|
+
//queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.WC_TOKEN_PUBSUB_SUBSCRIBE}`;
|
|
7824
|
+
//const url = ServerConfig.Instance.getServerURL() + queryStr;
|
|
7825
|
+
let response = await this.GetContent(url, false, null, null);
|
|
7826
|
+
//let uInt8Array:Uint8Array = new Uint8Array(response);
|
|
7827
|
+
return this.ArrayBufferToString(response);
|
|
7828
|
+
}
|
|
7811
7829
|
}
|
|
7812
7830
|
/// <summary>helper class: details from the runtime-engine - environment values.
|
|
7813
7831
|
/// Handshake response: <Richclientresponse> <ContextID>...</ContextID> <Environment InputPassword="Y|N"
|
|
@@ -13930,12 +13948,16 @@ class SubscriberClient {
|
|
|
13930
13948
|
* Subscribe to multiple topics at once
|
|
13931
13949
|
* @param topics Array of topics to subscribe to
|
|
13932
13950
|
*/
|
|
13933
|
-
subscribe(topics) {
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13951
|
+
subscribe(topics, token) {
|
|
13952
|
+
let ctxID = ClientManager.Instance.GetRuntimeCtxID();
|
|
13953
|
+
this.socket.emit('subscribe', topics, token, ctxID);
|
|
13954
|
+
// topics.forEach(topic => {
|
|
13955
|
+
// if (!this.subscribedTopics.has(topic)) {
|
|
13956
|
+
//
|
|
13957
|
+
// let ctxID = ClientManager.Instance.GetRuntimeCtxID()
|
|
13958
|
+
// this.socket.emit('subscribe', topic, token, ctxID);
|
|
13959
|
+
// }
|
|
13960
|
+
// });
|
|
13939
13961
|
}
|
|
13940
13962
|
/**
|
|
13941
13963
|
* Unsubscribe from multiple topics at once
|
|
@@ -15606,7 +15628,7 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
15606
15628
|
break;
|
|
15607
15629
|
case ExpressionInterface.EXP_OP_SUBSCRIBE:
|
|
15608
15630
|
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
15609
|
-
|
|
15631
|
+
this.eval_op_Subscribe(valStack);
|
|
15610
15632
|
break;
|
|
15611
15633
|
case ExpressionInterface.EXP_OP_UNSUBSCRIBE:
|
|
15612
15634
|
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
@@ -18704,7 +18726,7 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
18704
18726
|
}
|
|
18705
18727
|
return CryptoJS.lib.WordArray.create(words, u8.length);
|
|
18706
18728
|
}
|
|
18707
|
-
eval_op_Subscribe(valStack) {
|
|
18729
|
+
async eval_op_Subscribe(valStack) {
|
|
18708
18730
|
let nArgs = valStack.pop();
|
|
18709
18731
|
let result = false;
|
|
18710
18732
|
if (nArgs > 0) {
|
|
@@ -18713,9 +18735,10 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
18713
18735
|
for (let j = 0; j < nArgs; j++) {
|
|
18714
18736
|
Exp_params[nArgs - 1 - j] = valStack.pop();
|
|
18715
18737
|
}
|
|
18716
|
-
let sc = SubscriberClient.getInstance(this.ExpTask);
|
|
18717
18738
|
let topics = this.params2arguments(Exp_params, 0, Exp_params.length);
|
|
18718
|
-
|
|
18739
|
+
let token = await RemoteCommandsProcessor.GetInstance().GetSubscriptionTokenFromServer(topics);
|
|
18740
|
+
let sc = SubscriberClient.getInstance(this.ExpTask);
|
|
18741
|
+
sc.subscribe(topics, token);
|
|
18719
18742
|
result = true;
|
|
18720
18743
|
}
|
|
18721
18744
|
else {
|
|
@@ -39846,7 +39869,7 @@ class CommandsTable {
|
|
|
39846
39869
|
}
|
|
39847
39870
|
}
|
|
39848
39871
|
|
|
39849
|
-
let CurrentClientVersion = '4.1300.0-dev4130.
|
|
39872
|
+
let CurrentClientVersion = '4.1300.0-dev4130.180';
|
|
39850
39873
|
|
|
39851
39874
|
// @dynamic
|
|
39852
39875
|
class ClientManager {
|