@aws-amplify/pubsub 6.0.17-unstable.e316a2e.0 → 6.0.17
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/dist/cjs/vendor/paho-mqtt.js +74 -74
- package/dist/esm/vendor/paho-mqtt.js +74 -74
- package/package.json +102 -102
- package/src/Providers/AWSIot.ts +1 -1
- package/src/Providers/MqttOverWS.ts +7 -7
- package/src/utils/ConnectionStateMonitor.ts +6 -6
- package/src/vendor/paho-mqtt.js +74 -74
|
@@ -169,7 +169,7 @@ function onMessageArrived(message) {
|
|
|
169
169
|
if (keys.hasOwnProperty(key)) {
|
|
170
170
|
if (typeof obj[key] !== keys[key])
|
|
171
171
|
throw new Error(
|
|
172
|
-
format(ERROR.INVALID_TYPE, [typeof obj[key], key])
|
|
172
|
+
format(ERROR.INVALID_TYPE, [typeof obj[key], key]),
|
|
173
173
|
);
|
|
174
174
|
} else {
|
|
175
175
|
var errorStr =
|
|
@@ -403,7 +403,7 @@ function onMessageArrived(message) {
|
|
|
403
403
|
first = first |= this.payloadMessage.qos << 1;
|
|
404
404
|
if (this.payloadMessage.retained) first |= 0x01;
|
|
405
405
|
destinationNameLength = UTF8Length(
|
|
406
|
-
this.payloadMessage.destinationName
|
|
406
|
+
this.payloadMessage.destinationName,
|
|
407
407
|
);
|
|
408
408
|
remLength += destinationNameLength + 2;
|
|
409
409
|
var payloadBytes = this.payloadMessage.payloadBytes;
|
|
@@ -438,7 +438,7 @@ function onMessageArrived(message) {
|
|
|
438
438
|
this.payloadMessage.destinationName,
|
|
439
439
|
destinationNameLength,
|
|
440
440
|
byteStream,
|
|
441
|
-
pos
|
|
441
|
+
pos,
|
|
442
442
|
);
|
|
443
443
|
// If this is a CONNECT then the variable header contains the protocol name/version, flags and keepalive time
|
|
444
444
|
else if (this.type == MESSAGE_TYPE.CONNECT) {
|
|
@@ -477,19 +477,19 @@ function onMessageArrived(message) {
|
|
|
477
477
|
this.clientId,
|
|
478
478
|
UTF8Length(this.clientId),
|
|
479
479
|
byteStream,
|
|
480
|
-
pos
|
|
480
|
+
pos,
|
|
481
481
|
);
|
|
482
482
|
if (this.willMessage !== undefined) {
|
|
483
483
|
pos = writeString(
|
|
484
484
|
this.willMessage.destinationName,
|
|
485
485
|
UTF8Length(this.willMessage.destinationName),
|
|
486
486
|
byteStream,
|
|
487
|
-
pos
|
|
487
|
+
pos,
|
|
488
488
|
);
|
|
489
489
|
pos = writeUint16(
|
|
490
490
|
willMessagePayloadBytes.byteLength,
|
|
491
491
|
byteStream,
|
|
492
|
-
pos
|
|
492
|
+
pos,
|
|
493
493
|
);
|
|
494
494
|
byteStream.set(willMessagePayloadBytes, pos);
|
|
495
495
|
pos += willMessagePayloadBytes.byteLength;
|
|
@@ -499,14 +499,14 @@ function onMessageArrived(message) {
|
|
|
499
499
|
this.userName,
|
|
500
500
|
UTF8Length(this.userName),
|
|
501
501
|
byteStream,
|
|
502
|
-
pos
|
|
502
|
+
pos,
|
|
503
503
|
);
|
|
504
504
|
if (this.password !== undefined)
|
|
505
505
|
pos = writeString(
|
|
506
506
|
this.password,
|
|
507
507
|
UTF8Length(this.password),
|
|
508
508
|
byteStream,
|
|
509
|
-
pos
|
|
509
|
+
pos,
|
|
510
510
|
);
|
|
511
511
|
break;
|
|
512
512
|
|
|
@@ -528,7 +528,7 @@ function onMessageArrived(message) {
|
|
|
528
528
|
this.topics[i],
|
|
529
529
|
topicStrLength[i],
|
|
530
530
|
byteStream,
|
|
531
|
-
pos
|
|
531
|
+
pos,
|
|
532
532
|
);
|
|
533
533
|
byteStream[pos++] = this.requestedQos[i];
|
|
534
534
|
}
|
|
@@ -541,7 +541,7 @@ function onMessageArrived(message) {
|
|
|
541
541
|
this.topics[i],
|
|
542
542
|
topicStrLength[i],
|
|
543
543
|
byteStream,
|
|
544
|
-
pos
|
|
544
|
+
pos,
|
|
545
545
|
);
|
|
546
546
|
break;
|
|
547
547
|
|
|
@@ -699,7 +699,7 @@ function onMessageArrived(message) {
|
|
|
699
699
|
var lowCharCode = input.charCodeAt(++i);
|
|
700
700
|
if (isNaN(lowCharCode)) {
|
|
701
701
|
throw new Error(
|
|
702
|
-
format(ERROR.MALFORMED_UNICODE, [charCode, lowCharCode])
|
|
702
|
+
format(ERROR.MALFORMED_UNICODE, [charCode, lowCharCode]),
|
|
703
703
|
);
|
|
704
704
|
}
|
|
705
705
|
charCode =
|
|
@@ -741,7 +741,7 @@ function onMessageArrived(message) {
|
|
|
741
741
|
byte1.toString(16),
|
|
742
742
|
byte2.toString(16),
|
|
743
743
|
'',
|
|
744
|
-
])
|
|
744
|
+
]),
|
|
745
745
|
);
|
|
746
746
|
if (byte1 < 0xe0)
|
|
747
747
|
// 2 byte character
|
|
@@ -754,7 +754,7 @@ function onMessageArrived(message) {
|
|
|
754
754
|
byte1.toString(16),
|
|
755
755
|
byte2.toString(16),
|
|
756
756
|
byte3.toString(16),
|
|
757
|
-
])
|
|
757
|
+
]),
|
|
758
758
|
);
|
|
759
759
|
if (byte1 < 0xf0)
|
|
760
760
|
// 3 byte character
|
|
@@ -768,7 +768,7 @@ function onMessageArrived(message) {
|
|
|
768
768
|
byte2.toString(16),
|
|
769
769
|
byte3.toString(16),
|
|
770
770
|
byte4.toString(16),
|
|
771
|
-
])
|
|
771
|
+
]),
|
|
772
772
|
);
|
|
773
773
|
if (byte1 < 0xf8)
|
|
774
774
|
// 4 byte character
|
|
@@ -782,7 +782,7 @@ function onMessageArrived(message) {
|
|
|
782
782
|
byte2.toString(16),
|
|
783
783
|
byte3.toString(16),
|
|
784
784
|
byte4.toString(16),
|
|
785
|
-
])
|
|
785
|
+
]),
|
|
786
786
|
);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
@@ -822,7 +822,7 @@ function onMessageArrived(message) {
|
|
|
822
822
|
this._client._trace('Pinger.doPing', 'Timed out');
|
|
823
823
|
this._client._disconnected(
|
|
824
824
|
ERROR.PING_TIMEOUT.code,
|
|
825
|
-
format(ERROR.PING_TIMEOUT)
|
|
825
|
+
format(ERROR.PING_TIMEOUT),
|
|
826
826
|
);
|
|
827
827
|
} else {
|
|
828
828
|
this.isReset = false;
|
|
@@ -858,7 +858,7 @@ function onMessageArrived(message) {
|
|
|
858
858
|
};
|
|
859
859
|
this.timeout = setTimeout(
|
|
860
860
|
doTimeout(action, client, args),
|
|
861
|
-
timeoutSeconds * 1000
|
|
861
|
+
timeoutSeconds * 1000,
|
|
862
862
|
);
|
|
863
863
|
|
|
864
864
|
this.cancel = function () {
|
|
@@ -983,7 +983,7 @@ function onMessageArrived(message) {
|
|
|
983
983
|
'Client.connect',
|
|
984
984
|
connectOptionsMasked,
|
|
985
985
|
this.socket,
|
|
986
|
-
this.connected
|
|
986
|
+
this.connected,
|
|
987
987
|
);
|
|
988
988
|
|
|
989
989
|
if (this.connected)
|
|
@@ -1053,7 +1053,7 @@ function onMessageArrived(message) {
|
|
|
1053
1053
|
errorCode: ERROR.SUBSCRIBE_TIMEOUT.code,
|
|
1054
1054
|
errorMessage: format(ERROR.SUBSCRIBE_TIMEOUT),
|
|
1055
1055
|
},
|
|
1056
|
-
]
|
|
1056
|
+
],
|
|
1057
1057
|
);
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
@@ -1090,7 +1090,7 @@ function onMessageArrived(message) {
|
|
|
1090
1090
|
errorCode: ERROR.UNSUBSCRIBE_TIMEOUT.code,
|
|
1091
1091
|
errorMessage: format(ERROR.UNSUBSCRIBE_TIMEOUT),
|
|
1092
1092
|
},
|
|
1093
|
-
]
|
|
1093
|
+
],
|
|
1094
1094
|
);
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
@@ -1113,7 +1113,7 @@ function onMessageArrived(message) {
|
|
|
1113
1113
|
this._requires_ack(wireMessage);
|
|
1114
1114
|
} else if (this.onMessageDelivered) {
|
|
1115
1115
|
this._notify_msg_sent[wireMessage] = this.onMessageDelivered(
|
|
1116
|
-
wireMessage.payloadMessage
|
|
1116
|
+
wireMessage.payloadMessage,
|
|
1117
1117
|
);
|
|
1118
1118
|
}
|
|
1119
1119
|
this._schedule_message(wireMessage);
|
|
@@ -1127,7 +1127,7 @@ function onMessageArrived(message) {
|
|
|
1127
1127
|
this._buffered_msg_queue.length;
|
|
1128
1128
|
if (messageCount > this.disconnectedBufferSize) {
|
|
1129
1129
|
throw new Error(
|
|
1130
|
-
format(ERROR.BUFFER_FULL, [this.disconnectedBufferSize])
|
|
1130
|
+
format(ERROR.BUFFER_FULL, [this.disconnectedBufferSize]),
|
|
1131
1131
|
);
|
|
1132
1132
|
} else {
|
|
1133
1133
|
if (message.qos > 0) {
|
|
@@ -1158,7 +1158,7 @@ function onMessageArrived(message) {
|
|
|
1158
1158
|
|
|
1159
1159
|
if (!this.socket)
|
|
1160
1160
|
throw new Error(
|
|
1161
|
-
format(ERROR.INVALID_STATE, ['not connecting or connected'])
|
|
1161
|
+
format(ERROR.INVALID_STATE, ['not connecting or connected']),
|
|
1162
1162
|
);
|
|
1163
1163
|
|
|
1164
1164
|
var wireMessage = new WireMessage(MESSAGE_TYPE.DISCONNECT);
|
|
@@ -1176,7 +1176,7 @@ function onMessageArrived(message) {
|
|
|
1176
1176
|
this._trace('Client.getTraceLog', new Date());
|
|
1177
1177
|
this._trace(
|
|
1178
1178
|
'Client.getTraceLog in flight messages',
|
|
1179
|
-
this._sentMessages.length
|
|
1179
|
+
this._sentMessages.length,
|
|
1180
1180
|
);
|
|
1181
1181
|
for (var key in this._sentMessages)
|
|
1182
1182
|
this._trace('_sentMessages ', key, this._sentMessages[key]);
|
|
@@ -1222,7 +1222,7 @@ function onMessageArrived(message) {
|
|
|
1222
1222
|
this.sendPinger = new Pinger(this, this.connectOptions.keepAliveInterval);
|
|
1223
1223
|
this.receivePinger = new Pinger(
|
|
1224
1224
|
this,
|
|
1225
|
-
this.connectOptions.keepAliveInterval
|
|
1225
|
+
this.connectOptions.keepAliveInterval,
|
|
1226
1226
|
);
|
|
1227
1227
|
if (this._connectTimeout) {
|
|
1228
1228
|
this._connectTimeout.cancel();
|
|
@@ -1232,7 +1232,7 @@ function onMessageArrived(message) {
|
|
|
1232
1232
|
this,
|
|
1233
1233
|
this.connectOptions.timeout,
|
|
1234
1234
|
this._disconnected,
|
|
1235
|
-
[ERROR.CONNECT_TIMEOUT.code, format(ERROR.CONNECT_TIMEOUT)]
|
|
1235
|
+
[ERROR.CONNECT_TIMEOUT.code, format(ERROR.CONNECT_TIMEOUT)],
|
|
1236
1236
|
);
|
|
1237
1237
|
};
|
|
1238
1238
|
|
|
@@ -1293,12 +1293,12 @@ function onMessageArrived(message) {
|
|
|
1293
1293
|
format(ERROR.INVALID_STORED_DATA, [
|
|
1294
1294
|
prefix + this._localKey + wireMessage.messageIdentifier,
|
|
1295
1295
|
storedMessage,
|
|
1296
|
-
])
|
|
1296
|
+
]),
|
|
1297
1297
|
);
|
|
1298
1298
|
}
|
|
1299
1299
|
localStorage.setItem(
|
|
1300
1300
|
prefix + this._localKey + wireMessage.messageIdentifier,
|
|
1301
|
-
JSON.stringify(storedMessage)
|
|
1301
|
+
JSON.stringify(storedMessage),
|
|
1302
1302
|
);
|
|
1303
1303
|
};
|
|
1304
1304
|
|
|
@@ -1390,7 +1390,7 @@ function onMessageArrived(message) {
|
|
|
1390
1390
|
// Create the CONNECT message object.
|
|
1391
1391
|
var wireMessage = new WireMessage(
|
|
1392
1392
|
MESSAGE_TYPE.CONNECT,
|
|
1393
|
-
this.connectOptions
|
|
1393
|
+
this.connectOptions,
|
|
1394
1394
|
);
|
|
1395
1395
|
wireMessage.clientId = this.clientId;
|
|
1396
1396
|
this._socket_send(wireMessage);
|
|
@@ -1413,7 +1413,7 @@ function onMessageArrived(message) {
|
|
|
1413
1413
|
var messages = [];
|
|
1414
1414
|
if (this.receiveBuffer) {
|
|
1415
1415
|
var newData = new Uint8Array(
|
|
1416
|
-
this.receiveBuffer.length + byteArray.length
|
|
1416
|
+
this.receiveBuffer.length + byteArray.length,
|
|
1417
1417
|
);
|
|
1418
1418
|
newData.set(this.receiveBuffer);
|
|
1419
1419
|
newData.set(byteArray, this.receiveBuffer.length);
|
|
@@ -1442,7 +1442,7 @@ function onMessageArrived(message) {
|
|
|
1442
1442
|
: 'No Error Stack Available';
|
|
1443
1443
|
this._disconnected(
|
|
1444
1444
|
ERROR.INTERNAL_ERROR.code,
|
|
1445
|
-
format(ERROR.INTERNAL_ERROR, [error.message, errorStack])
|
|
1445
|
+
format(ERROR.INTERNAL_ERROR, [error.message, errorStack]),
|
|
1446
1446
|
);
|
|
1447
1447
|
return;
|
|
1448
1448
|
}
|
|
@@ -1463,7 +1463,7 @@ function onMessageArrived(message) {
|
|
|
1463
1463
|
for (var key in this._sentMessages) {
|
|
1464
1464
|
var sentMessage = this._sentMessages[key];
|
|
1465
1465
|
localStorage.removeItem(
|
|
1466
|
-
'Sent:' + this._localKey + sentMessage.messageIdentifier
|
|
1466
|
+
'Sent:' + this._localKey + sentMessage.messageIdentifier,
|
|
1467
1467
|
);
|
|
1468
1468
|
}
|
|
1469
1469
|
this._sentMessages = {};
|
|
@@ -1473,7 +1473,7 @@ function onMessageArrived(message) {
|
|
|
1473
1473
|
localStorage.removeItem(
|
|
1474
1474
|
'Received:' +
|
|
1475
1475
|
this._localKey +
|
|
1476
|
-
receivedMessage.messageIdentifier
|
|
1476
|
+
receivedMessage.messageIdentifier,
|
|
1477
1477
|
);
|
|
1478
1478
|
}
|
|
1479
1479
|
this._receivedMessages = {};
|
|
@@ -1491,7 +1491,7 @@ function onMessageArrived(message) {
|
|
|
1491
1491
|
format(ERROR.CONNACK_RETURNCODE, [
|
|
1492
1492
|
wireMessage.returnCode,
|
|
1493
1493
|
CONNACK_RC[wireMessage.returnCode],
|
|
1494
|
-
])
|
|
1494
|
+
]),
|
|
1495
1495
|
);
|
|
1496
1496
|
break;
|
|
1497
1497
|
}
|
|
@@ -1510,7 +1510,7 @@ function onMessageArrived(message) {
|
|
|
1510
1510
|
sequencedMessages.push(msg);
|
|
1511
1511
|
if (this.onMessageDelivered)
|
|
1512
1512
|
this._notify_msg_sent[msg] = this.onMessageDelivered(
|
|
1513
|
-
msg.payloadMessage
|
|
1513
|
+
msg.payloadMessage,
|
|
1514
1514
|
);
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
@@ -1567,7 +1567,7 @@ function onMessageArrived(message) {
|
|
|
1567
1567
|
if (sentMessage) {
|
|
1568
1568
|
delete this._sentMessages[wireMessage.messageIdentifier];
|
|
1569
1569
|
localStorage.removeItem(
|
|
1570
|
-
'Sent:' + this._localKey + wireMessage.messageIdentifier
|
|
1570
|
+
'Sent:' + this._localKey + wireMessage.messageIdentifier,
|
|
1571
1571
|
);
|
|
1572
1572
|
if (this.onMessageDelivered)
|
|
1573
1573
|
this.onMessageDelivered(sentMessage.payloadMessage);
|
|
@@ -1591,7 +1591,7 @@ function onMessageArrived(message) {
|
|
|
1591
1591
|
var receivedMessage =
|
|
1592
1592
|
this._receivedMessages[wireMessage.messageIdentifier];
|
|
1593
1593
|
localStorage.removeItem(
|
|
1594
|
-
'Received:' + this._localKey + wireMessage.messageIdentifier
|
|
1594
|
+
'Received:' + this._localKey + wireMessage.messageIdentifier,
|
|
1595
1595
|
);
|
|
1596
1596
|
// If this is a re flow of a PUBREL after we have restarted receivedMessage will not exist.
|
|
1597
1597
|
if (receivedMessage) {
|
|
@@ -1610,7 +1610,7 @@ function onMessageArrived(message) {
|
|
|
1610
1610
|
var sentMessage = this._sentMessages[wireMessage.messageIdentifier];
|
|
1611
1611
|
delete this._sentMessages[wireMessage.messageIdentifier];
|
|
1612
1612
|
localStorage.removeItem(
|
|
1613
|
-
'Sent:' + this._localKey + wireMessage.messageIdentifier
|
|
1613
|
+
'Sent:' + this._localKey + wireMessage.messageIdentifier,
|
|
1614
1614
|
);
|
|
1615
1615
|
if (this.onMessageDelivered)
|
|
1616
1616
|
this.onMessageDelivered(sentMessage.payloadMessage);
|
|
@@ -1653,14 +1653,14 @@ function onMessageArrived(message) {
|
|
|
1653
1653
|
// Clients do not expect to receive disconnect packets.
|
|
1654
1654
|
this._disconnected(
|
|
1655
1655
|
ERROR.INVALID_MQTT_MESSAGE_TYPE.code,
|
|
1656
|
-
format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type])
|
|
1656
|
+
format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type]),
|
|
1657
1657
|
);
|
|
1658
1658
|
break;
|
|
1659
1659
|
|
|
1660
1660
|
default:
|
|
1661
1661
|
this._disconnected(
|
|
1662
1662
|
ERROR.INVALID_MQTT_MESSAGE_TYPE.code,
|
|
1663
|
-
format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type])
|
|
1663
|
+
format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type]),
|
|
1664
1664
|
);
|
|
1665
1665
|
}
|
|
1666
1666
|
} catch (error) {
|
|
@@ -1670,7 +1670,7 @@ function onMessageArrived(message) {
|
|
|
1670
1670
|
: 'No Error Stack Available';
|
|
1671
1671
|
this._disconnected(
|
|
1672
1672
|
ERROR.INTERNAL_ERROR.code,
|
|
1673
|
-
format(ERROR.INTERNAL_ERROR, [error.message, errorStack])
|
|
1673
|
+
format(ERROR.INTERNAL_ERROR, [error.message, errorStack]),
|
|
1674
1674
|
);
|
|
1675
1675
|
return;
|
|
1676
1676
|
}
|
|
@@ -1681,7 +1681,7 @@ function onMessageArrived(message) {
|
|
|
1681
1681
|
if (!this._reconnecting) {
|
|
1682
1682
|
this._disconnected(
|
|
1683
1683
|
ERROR.SOCKET_ERROR.code,
|
|
1684
|
-
format(ERROR.SOCKET_ERROR, [error.data])
|
|
1684
|
+
format(ERROR.SOCKET_ERROR, [error.data]),
|
|
1685
1685
|
);
|
|
1686
1686
|
}
|
|
1687
1687
|
};
|
|
@@ -1790,7 +1790,7 @@ function onMessageArrived(message) {
|
|
|
1790
1790
|
this._reconnectTimeout = new Timeout(
|
|
1791
1791
|
this,
|
|
1792
1792
|
this._reconnectInterval,
|
|
1793
|
-
this._reconnect
|
|
1793
|
+
this._reconnect,
|
|
1794
1794
|
);
|
|
1795
1795
|
return;
|
|
1796
1796
|
}
|
|
@@ -1997,7 +1997,7 @@ function onMessageArrived(message) {
|
|
|
1997
1997
|
clientId = port;
|
|
1998
1998
|
uri = host;
|
|
1999
1999
|
var match = uri.match(
|
|
2000
|
-
/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)
|
|
2000
|
+
/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)$/,
|
|
2001
2001
|
);
|
|
2002
2002
|
if (match) {
|
|
2003
2003
|
host = match[4] || match[2];
|
|
@@ -2095,7 +2095,7 @@ function onMessageArrived(message) {
|
|
|
2095
2095
|
format(ERROR.INVALID_TYPE, [
|
|
2096
2096
|
typeof newOnConnected,
|
|
2097
2097
|
'onConnected',
|
|
2098
|
-
])
|
|
2098
|
+
]),
|
|
2099
2099
|
);
|
|
2100
2100
|
},
|
|
2101
2101
|
},
|
|
@@ -2127,7 +2127,7 @@ function onMessageArrived(message) {
|
|
|
2127
2127
|
format(ERROR.INVALID_TYPE, [
|
|
2128
2128
|
typeof newOnConnectionLost,
|
|
2129
2129
|
'onConnectionLost',
|
|
2130
|
-
])
|
|
2130
|
+
]),
|
|
2131
2131
|
);
|
|
2132
2132
|
},
|
|
2133
2133
|
},
|
|
@@ -2143,7 +2143,7 @@ function onMessageArrived(message) {
|
|
|
2143
2143
|
format(ERROR.INVALID_TYPE, [
|
|
2144
2144
|
typeof newOnMessageDelivered,
|
|
2145
2145
|
'onMessageDelivered',
|
|
2146
|
-
])
|
|
2146
|
+
]),
|
|
2147
2147
|
);
|
|
2148
2148
|
},
|
|
2149
2149
|
},
|
|
@@ -2159,7 +2159,7 @@ function onMessageArrived(message) {
|
|
|
2159
2159
|
format(ERROR.INVALID_TYPE, [
|
|
2160
2160
|
typeof newOnMessageArrived,
|
|
2161
2161
|
'onMessageArrived',
|
|
2162
|
-
])
|
|
2162
|
+
]),
|
|
2163
2163
|
);
|
|
2164
2164
|
},
|
|
2165
2165
|
},
|
|
@@ -2172,7 +2172,7 @@ function onMessageArrived(message) {
|
|
|
2172
2172
|
client.traceFunction = trace;
|
|
2173
2173
|
} else {
|
|
2174
2174
|
throw new Error(
|
|
2175
|
-
format(ERROR.INVALID_TYPE, [typeof trace, 'onTrace'])
|
|
2175
|
+
format(ERROR.INVALID_TYPE, [typeof trace, 'onTrace']),
|
|
2176
2176
|
);
|
|
2177
2177
|
}
|
|
2178
2178
|
},
|
|
@@ -2271,7 +2271,7 @@ function onMessageArrived(message) {
|
|
|
2271
2271
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2272
2272
|
connectOptions.mqttVersion,
|
|
2273
2273
|
'connectOptions.mqttVersion',
|
|
2274
|
-
])
|
|
2274
|
+
]),
|
|
2275
2275
|
);
|
|
2276
2276
|
}
|
|
2277
2277
|
|
|
@@ -2291,7 +2291,7 @@ function onMessageArrived(message) {
|
|
|
2291
2291
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2292
2292
|
connectOptions.password,
|
|
2293
2293
|
'connectOptions.password',
|
|
2294
|
-
])
|
|
2294
|
+
]),
|
|
2295
2295
|
);
|
|
2296
2296
|
|
|
2297
2297
|
if (connectOptions.willMessage) {
|
|
@@ -2300,7 +2300,7 @@ function onMessageArrived(message) {
|
|
|
2300
2300
|
format(ERROR.INVALID_TYPE, [
|
|
2301
2301
|
connectOptions.willMessage,
|
|
2302
2302
|
'connectOptions.willMessage',
|
|
2303
|
-
])
|
|
2303
|
+
]),
|
|
2304
2304
|
);
|
|
2305
2305
|
// The will message must have a payload that can be represented as a string.
|
|
2306
2306
|
// Cause the willMessage to throw an exception if this is not the case.
|
|
@@ -2311,7 +2311,7 @@ function onMessageArrived(message) {
|
|
|
2311
2311
|
format(ERROR.INVALID_TYPE, [
|
|
2312
2312
|
typeof connectOptions.willMessage.destinationName,
|
|
2313
2313
|
'connectOptions.willMessage.destinationName',
|
|
2314
|
-
])
|
|
2314
|
+
]),
|
|
2315
2315
|
);
|
|
2316
2316
|
}
|
|
2317
2317
|
if (typeof connectOptions.cleanSession === 'undefined')
|
|
@@ -2322,14 +2322,14 @@ function onMessageArrived(message) {
|
|
|
2322
2322
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2323
2323
|
connectOptions.hosts,
|
|
2324
2324
|
'connectOptions.hosts',
|
|
2325
|
-
])
|
|
2325
|
+
]),
|
|
2326
2326
|
);
|
|
2327
2327
|
if (connectOptions.hosts.length < 1)
|
|
2328
2328
|
throw new Error(
|
|
2329
2329
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2330
2330
|
connectOptions.hosts,
|
|
2331
2331
|
'connectOptions.hosts',
|
|
2332
|
-
])
|
|
2332
|
+
]),
|
|
2333
2333
|
);
|
|
2334
2334
|
|
|
2335
2335
|
var usingURIs = false;
|
|
@@ -2339,11 +2339,11 @@ function onMessageArrived(message) {
|
|
|
2339
2339
|
format(ERROR.INVALID_TYPE, [
|
|
2340
2340
|
typeof connectOptions.hosts[i],
|
|
2341
2341
|
'connectOptions.hosts[' + i + ']',
|
|
2342
|
-
])
|
|
2342
|
+
]),
|
|
2343
2343
|
);
|
|
2344
2344
|
if (
|
|
2345
2345
|
/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)$/.test(
|
|
2346
|
-
connectOptions.hosts[i]
|
|
2346
|
+
connectOptions.hosts[i],
|
|
2347
2347
|
)
|
|
2348
2348
|
) {
|
|
2349
2349
|
if (i === 0) {
|
|
@@ -2353,7 +2353,7 @@ function onMessageArrived(message) {
|
|
|
2353
2353
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2354
2354
|
connectOptions.hosts[i],
|
|
2355
2355
|
'connectOptions.hosts[' + i + ']',
|
|
2356
|
-
])
|
|
2356
|
+
]),
|
|
2357
2357
|
);
|
|
2358
2358
|
}
|
|
2359
2359
|
} else if (usingURIs) {
|
|
@@ -2361,7 +2361,7 @@ function onMessageArrived(message) {
|
|
|
2361
2361
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2362
2362
|
connectOptions.hosts[i],
|
|
2363
2363
|
'connectOptions.hosts[' + i + ']',
|
|
2364
|
-
])
|
|
2364
|
+
]),
|
|
2365
2365
|
);
|
|
2366
2366
|
}
|
|
2367
2367
|
}
|
|
@@ -2372,21 +2372,21 @@ function onMessageArrived(message) {
|
|
|
2372
2372
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2373
2373
|
connectOptions.ports,
|
|
2374
2374
|
'connectOptions.ports',
|
|
2375
|
-
])
|
|
2375
|
+
]),
|
|
2376
2376
|
);
|
|
2377
2377
|
if (!(connectOptions.ports instanceof Array))
|
|
2378
2378
|
throw new Error(
|
|
2379
2379
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2380
2380
|
connectOptions.ports,
|
|
2381
2381
|
'connectOptions.ports',
|
|
2382
|
-
])
|
|
2382
|
+
]),
|
|
2383
2383
|
);
|
|
2384
2384
|
if (connectOptions.hosts.length !== connectOptions.ports.length)
|
|
2385
2385
|
throw new Error(
|
|
2386
2386
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2387
2387
|
connectOptions.ports,
|
|
2388
2388
|
'connectOptions.ports',
|
|
2389
|
-
])
|
|
2389
|
+
]),
|
|
2390
2390
|
);
|
|
2391
2391
|
|
|
2392
2392
|
connectOptions.uris = [];
|
|
@@ -2400,7 +2400,7 @@ function onMessageArrived(message) {
|
|
|
2400
2400
|
format(ERROR.INVALID_TYPE, [
|
|
2401
2401
|
typeof connectOptions.ports[i],
|
|
2402
2402
|
'connectOptions.ports[' + i + ']',
|
|
2403
|
-
])
|
|
2403
|
+
]),
|
|
2404
2404
|
);
|
|
2405
2405
|
var host = connectOptions.hosts[i];
|
|
2406
2406
|
var port = connectOptions.ports[i];
|
|
@@ -2463,7 +2463,7 @@ function onMessageArrived(message) {
|
|
|
2463
2463
|
});
|
|
2464
2464
|
if (subscribeOptions.timeout && !subscribeOptions.onFailure)
|
|
2465
2465
|
throw new Error(
|
|
2466
|
-
'subscribeOptions.timeout specified with no onFailure callback.'
|
|
2466
|
+
'subscribeOptions.timeout specified with no onFailure callback.',
|
|
2467
2467
|
);
|
|
2468
2468
|
if (
|
|
2469
2469
|
typeof subscribeOptions.qos !== 'undefined' &&
|
|
@@ -2477,7 +2477,7 @@ function onMessageArrived(message) {
|
|
|
2477
2477
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2478
2478
|
subscribeOptions.qos,
|
|
2479
2479
|
'subscribeOptions.qos',
|
|
2480
|
-
])
|
|
2480
|
+
]),
|
|
2481
2481
|
);
|
|
2482
2482
|
client.subscribe(filter, subscribeOptions);
|
|
2483
2483
|
};
|
|
@@ -2522,7 +2522,7 @@ function onMessageArrived(message) {
|
|
|
2522
2522
|
});
|
|
2523
2523
|
if (unsubscribeOptions.timeout && !unsubscribeOptions.onFailure)
|
|
2524
2524
|
throw new Error(
|
|
2525
|
-
'unsubscribeOptions.timeout specified with no onFailure callback.'
|
|
2525
|
+
'unsubscribeOptions.timeout specified with no onFailure callback.',
|
|
2526
2526
|
);
|
|
2527
2527
|
client.unsubscribe(filter, unsubscribeOptions);
|
|
2528
2528
|
};
|
|
@@ -2564,7 +2564,7 @@ function onMessageArrived(message) {
|
|
|
2564
2564
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2565
2565
|
message.destinationName,
|
|
2566
2566
|
'Message.destinationName',
|
|
2567
|
-
])
|
|
2567
|
+
]),
|
|
2568
2568
|
);
|
|
2569
2569
|
client.send(message);
|
|
2570
2570
|
} else {
|
|
@@ -2615,7 +2615,7 @@ function onMessageArrived(message) {
|
|
|
2615
2615
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2616
2616
|
message.destinationName,
|
|
2617
2617
|
'Message.destinationName',
|
|
2618
|
-
])
|
|
2618
|
+
]),
|
|
2619
2619
|
);
|
|
2620
2620
|
client.send(message);
|
|
2621
2621
|
} else {
|
|
@@ -2761,7 +2761,7 @@ function onMessageArrived(message) {
|
|
|
2761
2761
|
format(ERROR.INVALID_ARGUMENT, [
|
|
2762
2762
|
newDestinationName,
|
|
2763
2763
|
'newDestinationName',
|
|
2764
|
-
])
|
|
2764
|
+
]),
|
|
2765
2765
|
);
|
|
2766
2766
|
},
|
|
2767
2767
|
},
|
|
@@ -2784,7 +2784,7 @@ function onMessageArrived(message) {
|
|
|
2784
2784
|
if (typeof newRetained === 'boolean') retained = newRetained;
|
|
2785
2785
|
else
|
|
2786
2786
|
throw new Error(
|
|
2787
|
-
format(ERROR.INVALID_ARGUMENT, [newRetained, 'newRetained'])
|
|
2787
|
+
format(ERROR.INVALID_ARGUMENT, [newRetained, 'newRetained']),
|
|
2788
2788
|
);
|
|
2789
2789
|
},
|
|
2790
2790
|
},
|
|
@@ -2819,10 +2819,10 @@ function onMessageArrived(message) {
|
|
|
2819
2819
|
typeof global !== 'undefined'
|
|
2820
2820
|
? global
|
|
2821
2821
|
: typeof self !== 'undefined'
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2822
|
+
? self
|
|
2823
|
+
: typeof window !== 'undefined'
|
|
2824
|
+
? window
|
|
2825
|
+
: {},
|
|
2826
2826
|
);
|
|
2827
2827
|
return PahoMQTT;
|
|
2828
2828
|
});
|