corebasic 1.0.90 → 1.0.92
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.
- package/libs/features.js +3 -1
- package/libs/messaging.js +5 -5
- package/package.json +1 -1
package/libs/features.js
CHANGED
|
@@ -35,6 +35,7 @@ export const send = async (feature, params, payload, headers) => {
|
|
|
35
35
|
return (await axios[method](`${service}${url}`, { data: payload, headers: {jwt: headers.jwt}, timeout: 1000 })).data
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
let appids = {}
|
|
38
39
|
async function announce() {
|
|
39
40
|
let exp_features = {}
|
|
40
41
|
for (let [key, {api}] of Object.entries(features))
|
|
@@ -42,7 +43,8 @@ async function announce() {
|
|
|
42
43
|
|
|
43
44
|
await Messaging.subscribe("SLYP_FEATURES_LIST", async (message, channel) => {
|
|
44
45
|
let msg = JSON.parse(message)
|
|
45
|
-
if (msg.uid !== appId) {
|
|
46
|
+
if (msg.uid !== appId && !appids[msg.uid]) {
|
|
47
|
+
appids[msg.uid] = true
|
|
46
48
|
SLYP_FEATURES_LIST = {...SLYP_FEATURES_LIST, ...msg}
|
|
47
49
|
delete SLYP_FEATURES_LIST.uid
|
|
48
50
|
await Messaging.produce("SLYP_FEATURES_LIST", JSON.stringify({...exp_features, uid: appId }))
|
package/libs/messaging.js
CHANGED
|
@@ -94,15 +94,15 @@ export async function newProducer() {
|
|
|
94
94
|
return publisher
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
let defaultConsumer = await newConsumer()
|
|
98
|
+
let defaultProducer = await newProducer()
|
|
99
|
+
|
|
97
100
|
export async function subscribe(channel, listener) {
|
|
98
|
-
|
|
99
|
-
await consumer.subscribe(channel, listener)
|
|
101
|
+
await defaultConsumer.subscribe(channel, listener)
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
|
|
103
104
|
export async function produce(channel, message) {
|
|
104
|
-
|
|
105
|
-
await producer.publish(channel, message)
|
|
105
|
+
await defaultProducer.publish(channel, message)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
|