versacall-core-library-react 2.0.83-dev → 2.0.85-dev
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.
|
@@ -216,8 +216,8 @@ function onConnack(body) {
|
|
|
216
216
|
// Resubscribe every channel the app has asked for.
|
|
217
217
|
// This handles both initial subscription after connect AND
|
|
218
218
|
// re-subscription after an unintended disconnect / reconnect.
|
|
219
|
-
activeSubscriptions.forEach(
|
|
220
|
-
wsSend(buildSubscribe(nextPacketId(),
|
|
219
|
+
activeSubscriptions.forEach(sub => {
|
|
220
|
+
wsSend(buildSubscribe(nextPacketId(), "".concat(sub.channelKey, "/").concat(sub.channelName, "/")));
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -233,9 +233,12 @@ function onPublish(flags, body) {
|
|
|
233
233
|
const topicLen = body[0] << 8 | body[1];
|
|
234
234
|
if (2 + topicLen > body.length) return;
|
|
235
235
|
const topic = textDecoder.decode(body.slice(2, 2 + topicLen));
|
|
236
|
+
console.log('[vc-worker] topic:', topic);
|
|
236
237
|
const qos = flags >> 1 & 0x03;
|
|
238
|
+
console.log('[vc-worker] qos:', qos);
|
|
237
239
|
const payloadStart = 2 + topicLen + (qos > 0 ? 2 : 0);
|
|
238
240
|
const payloadStr = textDecoder.decode(body.slice(payloadStart));
|
|
241
|
+
console.log('[vc-worker] payload first 200 chars:', payloadStr.substring(0, 200));
|
|
239
242
|
|
|
240
243
|
// TEMPORARY DEBUG - remove after diagnosis
|
|
241
244
|
ports.forEach(port => {
|
|
@@ -256,7 +259,7 @@ function onPublish(flags, body) {
|
|
|
256
259
|
// Look up channelName from activeSubscriptions — emitter-io only
|
|
257
260
|
// exposes the channelName (not the full key/name/ MQTT topic)
|
|
258
261
|
const sub = activeSubscriptions.get(topic);
|
|
259
|
-
const channelName = sub ? sub.channelName : topic.replace(/\/$/, '')
|
|
262
|
+
const channelName = sub ? sub.channelName : topic.replace(/\/$/, '');
|
|
260
263
|
broadcast({
|
|
261
264
|
type: 'MESSAGE',
|
|
262
265
|
channel: channelName,
|
|
@@ -388,25 +391,24 @@ function handlePortMessage(port, msg) {
|
|
|
388
391
|
}
|
|
389
392
|
case 'SUBSCRIBE':
|
|
390
393
|
{
|
|
391
|
-
|
|
392
|
-
const
|
|
393
|
-
activeSubscriptions.set(
|
|
394
|
+
const mqttTopic = "".concat(msg.channelKey, "/").concat(msg.channelName, "/");
|
|
395
|
+
const lookupKey = "".concat(msg.channelName, "/");
|
|
396
|
+
activeSubscriptions.set(lookupKey, {
|
|
394
397
|
channelKey: msg.channelKey,
|
|
395
398
|
channelName: msg.channelName
|
|
396
399
|
});
|
|
397
|
-
// Send SUBSCRIBE immediately if already connected; otherwise the topic
|
|
398
|
-
// will be replayed in onConnack() when the connection comes up.
|
|
399
400
|
if (mqttConnected) {
|
|
400
|
-
wsSend(buildSubscribe(nextPacketId(),
|
|
401
|
+
wsSend(buildSubscribe(nextPacketId(), mqttTopic));
|
|
401
402
|
}
|
|
402
403
|
break;
|
|
403
404
|
}
|
|
404
405
|
case 'UNSUBSCRIBE':
|
|
405
406
|
{
|
|
406
|
-
const
|
|
407
|
-
activeSubscriptions.delete(
|
|
407
|
+
const lookupKey = "".concat(msg.channelName, "/");
|
|
408
|
+
activeSubscriptions.delete(lookupKey);
|
|
409
|
+
const mqttTopic = "".concat(msg.channelKey, "/").concat(msg.channelName, "/");
|
|
408
410
|
if (mqttConnected) {
|
|
409
|
-
wsSend(buildUnsubscribe(nextPacketId(),
|
|
411
|
+
wsSend(buildUnsubscribe(nextPacketId(), mqttTopic));
|
|
410
412
|
}
|
|
411
413
|
break;
|
|
412
414
|
}
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"versacall": {
|
|
3
3
|
"title": "Versacall Core Library React",
|
|
4
4
|
"applicationType": "react-library",
|
|
5
|
-
"build":
|
|
5
|
+
"build": 85
|
|
6
6
|
},
|
|
7
7
|
"name": "versacall-core-library-react",
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.85-dev",
|
|
9
9
|
"description": "Versacall Core Library",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|