versacall-core-library-react 2.0.85-dev → 2.0.86-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.
|
@@ -172,8 +172,6 @@ function initWorkerPort(host, secure, log) {
|
|
|
172
172
|
type
|
|
173
173
|
} = ev.data;
|
|
174
174
|
if (type === 'MESSAGE') {
|
|
175
|
-
// ev.data.channel is the raw MQTT topic "{channelKey}/{channelName}/"
|
|
176
|
-
// — identical to what emitter-io exposed as msg.channel.
|
|
177
175
|
processMessage(ev.data.channel, ev.data.data);
|
|
178
176
|
} else if (type === 'CONNECTION_CHANGED') {
|
|
179
177
|
log('system', namespace, 'workerPort.onmessage', ev.data.connected ? 'Emitter Connect' : 'Emitter Disconnect');
|
|
@@ -166,7 +166,6 @@ function decodeVarInt(buf, offset) {
|
|
|
166
166
|
* Leaves any trailing incomplete bytes in receiveBuffer.
|
|
167
167
|
*/
|
|
168
168
|
function drainBuffer() {
|
|
169
|
-
console.log('[vc-worker] drainBuffer called, buffer length:', receiveBuffer.length);
|
|
170
169
|
let offset = 0;
|
|
171
170
|
while (offset < receiveBuffer.length) {
|
|
172
171
|
const firstByte = receiveBuffer[offset];
|
|
@@ -187,7 +186,6 @@ function drainBuffer() {
|
|
|
187
186
|
|
|
188
187
|
/** Route a decoded MQTT packet to the appropriate handler. */
|
|
189
188
|
function dispatchMqttPacket(type, flags, body) {
|
|
190
|
-
console.log('[vc-worker] dispatchMqttPacket type:', type, 'body length:', body.length);
|
|
191
189
|
switch (type) {
|
|
192
190
|
case 2:
|
|
193
191
|
return onConnack(body);
|
|
@@ -228,27 +226,13 @@ function onConnack(body) {
|
|
|
228
226
|
* forward it unchanged — ChannelsConsumer handlers will match as before.
|
|
229
227
|
*/
|
|
230
228
|
function onPublish(flags, body) {
|
|
231
|
-
console.log('[vc-worker] onPublish called, body length:', body.length);
|
|
232
229
|
if (body.length < 2) return;
|
|
233
230
|
const topicLen = body[0] << 8 | body[1];
|
|
234
231
|
if (2 + topicLen > body.length) return;
|
|
235
232
|
const topic = textDecoder.decode(body.slice(2, 2 + topicLen));
|
|
236
|
-
console.log('[vc-worker] topic:', topic);
|
|
237
233
|
const qos = flags >> 1 & 0x03;
|
|
238
|
-
console.log('[vc-worker] qos:', qos);
|
|
239
234
|
const payloadStart = 2 + topicLen + (qos > 0 ? 2 : 0);
|
|
240
235
|
const payloadStr = textDecoder.decode(body.slice(payloadStart));
|
|
241
|
-
console.log('[vc-worker] payload first 200 chars:', payloadStr.substring(0, 200));
|
|
242
|
-
|
|
243
|
-
// TEMPORARY DEBUG - remove after diagnosis
|
|
244
|
-
ports.forEach(port => {
|
|
245
|
-
try {
|
|
246
|
-
port.postMessage({
|
|
247
|
-
type: 'LOG',
|
|
248
|
-
message: 'RAW TOPIC: ' + topic + ' | QOS: ' + qos + ' | PAYLOAD: ' + payloadStr.substring(0, 200)
|
|
249
|
-
});
|
|
250
|
-
} catch (_) {}
|
|
251
|
-
});
|
|
252
236
|
let data;
|
|
253
237
|
try {
|
|
254
238
|
data = JSON.parse(payloadStr);
|
|
@@ -308,7 +292,6 @@ function openWebSocket(config) {
|
|
|
308
292
|
pingIntervalId = setInterval(() => wsSend(PINGREQ), 25000);
|
|
309
293
|
};
|
|
310
294
|
ws.onmessage = ev => {
|
|
311
|
-
console.log('[vc-worker] WebSocket data received, bytes:', ev.data.byteLength);
|
|
312
295
|
receiveBuffer = concat(receiveBuffer, new Uint8Array(ev.data));
|
|
313
296
|
drainBuffer();
|
|
314
297
|
};
|
|
@@ -369,10 +352,6 @@ function handlePortMessage(port, msg) {
|
|
|
369
352
|
// First INIT — record config and open the connection.
|
|
370
353
|
wsConfig = config;
|
|
371
354
|
openWebSocket(config);
|
|
372
|
-
port.postMessage({
|
|
373
|
-
type: 'LOG',
|
|
374
|
-
message: 'Worker: first INIT, opening WebSocket'
|
|
375
|
-
});
|
|
376
355
|
} else if (mqttConnected) {
|
|
377
356
|
// Subsequent INIT from a later iframe — we're already live.
|
|
378
357
|
// Immediately tell the new port so it can update connection-state UI.
|
|
@@ -380,10 +359,6 @@ function handlePortMessage(port, msg) {
|
|
|
380
359
|
type: 'CONNECTION_CHANGED',
|
|
381
360
|
connected: true
|
|
382
361
|
});
|
|
383
|
-
port.postMessage({
|
|
384
|
-
type: 'LOG',
|
|
385
|
-
message: 'Worker: subsequent INIT, reusing existing connection. Total ports: ' + ports.size
|
|
386
|
-
});
|
|
387
362
|
}
|
|
388
363
|
// If !mqttConnected and wsConfig is already set we're in the middle of
|
|
389
364
|
// connecting; the CONNACK broadcast will reach the new port once ready.
|
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": 86
|
|
6
6
|
},
|
|
7
7
|
"name": "versacall-core-library-react",
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.86-dev",
|
|
9
9
|
"description": "Versacall Core Library",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|