vrpc 3.0.1 → 3.0.2
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/CHANGELOG.md +11 -0
- package/browser/vrpc.js +1 -1
- package/package.json +1 -1
- package/vrpc/VrpcAdapter.js +4 -2
- package/vrpc/VrpcAgent.js +4 -5
- package/vrpc/VrpcClient.js +1 -2
- package/vrpc/vrpc-agent-js +1 -1
package/package.json
CHANGED
package/vrpc/VrpcAdapter.js
CHANGED
|
@@ -608,11 +608,13 @@ class VrpcAdapter {
|
|
|
608
608
|
|
|
609
609
|
static _unregisterClient (clientId) {
|
|
610
610
|
for (const [key, value] of Object.entries(VrpcAdapter._listeners)) {
|
|
611
|
-
const {
|
|
611
|
+
const { instances, event, listener, clients } = value
|
|
612
612
|
clients.delete(clientId)
|
|
613
613
|
if (clients.size === 0) {
|
|
614
614
|
if (event) {
|
|
615
|
-
|
|
615
|
+
instances.forEach(instance => {
|
|
616
|
+
VrpcAdapter.getInstance(instance).removeListener(event, listener)
|
|
617
|
+
})
|
|
616
618
|
}
|
|
617
619
|
delete VrpcAdapter._listeners[key]
|
|
618
620
|
}
|
package/vrpc/VrpcAgent.js
CHANGED
|
@@ -48,7 +48,7 @@ class VrpcAgent extends EventEmitter {
|
|
|
48
48
|
})
|
|
49
49
|
parser.add_argument('-d', '--domain', {
|
|
50
50
|
help: 'Domain name',
|
|
51
|
-
default: domain || '
|
|
51
|
+
default: domain || 'vrpc'
|
|
52
52
|
})
|
|
53
53
|
parser.add_argument('-t', '--token', {
|
|
54
54
|
help: 'access token',
|
|
@@ -95,7 +95,7 @@ class VrpcAgent extends EventEmitter {
|
|
|
95
95
|
* @param {String} [obj.username] MQTT username (if no token is used)
|
|
96
96
|
* @param {String} [obj.password] MQTT password (if no token is provided)
|
|
97
97
|
* @param {String} [obj.token] Access token as generated by: https://app.vrpc.io (only optional when using default domain and broker)
|
|
98
|
-
* @param {String} [obj.domain='
|
|
98
|
+
* @param {String} [obj.domain='vrpc'] The domain under which the agent-provided code is reachable
|
|
99
99
|
* @param {String} [obj.agent='<user>-<pathId>@<hostname>-<platform>-js'] This agent's name
|
|
100
100
|
* @param {String} [obj.broker='mqtts://vrpc.io:8883'] Broker url in form: `<scheme>://<host>:<port>`
|
|
101
101
|
* @param {Object} [obj.log=console] Log object (must support debug, info, warn, and error level)
|
|
@@ -104,7 +104,7 @@ class VrpcAgent extends EventEmitter {
|
|
|
104
104
|
*
|
|
105
105
|
* @example
|
|
106
106
|
* const agent = new Agent({
|
|
107
|
-
* domain: '
|
|
107
|
+
* domain: 'vrpc'
|
|
108
108
|
* agent: 'myAgent'
|
|
109
109
|
* })
|
|
110
110
|
*/
|
|
@@ -112,7 +112,7 @@ class VrpcAgent extends EventEmitter {
|
|
|
112
112
|
username,
|
|
113
113
|
password,
|
|
114
114
|
token,
|
|
115
|
-
domain = '
|
|
115
|
+
domain = 'vrpc',
|
|
116
116
|
agent = VrpcAgent._generateAgentName(),
|
|
117
117
|
broker = 'mqtts://vrpc.io:8883',
|
|
118
118
|
log = 'console',
|
|
@@ -173,7 +173,6 @@ class VrpcAgent extends EventEmitter {
|
|
|
173
173
|
let username = this._username
|
|
174
174
|
let password = this._password
|
|
175
175
|
if (this._token) {
|
|
176
|
-
username = '__token__'
|
|
177
176
|
password = this._token
|
|
178
177
|
}
|
|
179
178
|
this._options = {
|
package/vrpc/VrpcClient.js
CHANGED
|
@@ -70,7 +70,7 @@ class VrpcClient extends EventEmitter {
|
|
|
70
70
|
* @param {Boolean} [options.bestEffort=false] If true, message will be sent with best effort, i.e. no caching if offline
|
|
71
71
|
* @example
|
|
72
72
|
* const client = new VrpcClient({
|
|
73
|
-
* domain: '
|
|
73
|
+
* domain: 'vrpc',
|
|
74
74
|
* broker: 'mqtt://vrpc.io'
|
|
75
75
|
* })
|
|
76
76
|
*/
|
|
@@ -152,7 +152,6 @@ class VrpcClient extends EventEmitter {
|
|
|
152
152
|
let username = this._username
|
|
153
153
|
let password = this._password
|
|
154
154
|
if (this._token) {
|
|
155
|
-
username = '__token__'
|
|
156
155
|
password = this._token
|
|
157
156
|
}
|
|
158
157
|
const options = {
|