@reactoo/watchtogether-sdk-js 2.5.74 → 2.5.76
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/watchtogether-sdk.js +211 -166
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +11 -6
- package/package.json +1 -1
- package/src/models/asset.js +1 -1
- package/src/models/auth.js +5 -0
- package/src/models/room.js +2 -2
- package/src/models/system.js +37 -0
- package/src/models/user.js +10 -8
- package/src/modules/wt-iot-worker.js +245 -0
- package/src/modules/wt-iot.js +3 -0
package/example/index.html
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
<button onclick="unpublish()">unpublish</button>
|
|
18
18
|
<button onclick="toggleVideo()">toggle video</button>
|
|
19
19
|
<button onclick="toggleAudio()">toggle audio</button>
|
|
20
|
+
<button onclick="hento()">sign to goole</button>
|
|
20
21
|
</div>
|
|
21
22
|
|
|
22
23
|
</div>
|
|
@@ -41,6 +42,15 @@
|
|
|
41
42
|
// });
|
|
42
43
|
// }
|
|
43
44
|
|
|
45
|
+
function hento() {
|
|
46
|
+
//Instance.system.getSettings();
|
|
47
|
+
Instance.auth.socialAuth({provider: 'youtube', action: 'generateAuthUrl'})
|
|
48
|
+
.then(r => {
|
|
49
|
+
window.open(r.data.redirectUrl);
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
function createParticipant(data, isRemote = false) {
|
|
45
55
|
|
|
46
56
|
let id = `part_${data.id}`;
|
|
@@ -97,7 +107,7 @@
|
|
|
97
107
|
Instance.room.getSessionByConstructId(constructId).toggleAudio()
|
|
98
108
|
}
|
|
99
109
|
|
|
100
|
-
let Instance = WatchTogetherSDK({debug:true, apiUrl: 'https://api.reactoo.com/
|
|
110
|
+
let Instance = WatchTogetherSDK({debug:true, apiUrl: 'https://api.reactoo.com/stefan/swagger.json'})({instanceType:'reactooDemo'});
|
|
101
111
|
|
|
102
112
|
Instance.auth.$on('login', () => {
|
|
103
113
|
console.log('We are in');
|
|
@@ -122,9 +132,7 @@
|
|
|
122
132
|
Instance.auth.deviceLogin(true) // login as browser
|
|
123
133
|
.then(r => Instance.iot.iotLogin()) // login to mqtt
|
|
124
134
|
.then(r => {
|
|
125
|
-
|
|
126
135
|
if(roomId) {
|
|
127
|
-
console.log(roomId);
|
|
128
136
|
return Instance.room.getRoomById(roomId, pinHash).then((r) => {
|
|
129
137
|
Instance.iot?.subscribe(r.data.iotTopic);
|
|
130
138
|
return {roomId, pinHash}
|
|
@@ -136,9 +144,6 @@
|
|
|
136
144
|
.then(r => r.data.items.length ? r.data.items[0] : Instance.room.createRoom({title:'Demo Room'}).then(r => r.data))
|
|
137
145
|
.then(r => Instance.room.getInviteUrl(r._id)) // getting info about invite params
|
|
138
146
|
.then((r) => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
147
|
roomId = r.data.roomId;
|
|
143
148
|
|
|
144
149
|
console.log('-----------------------------------------------------');
|
package/package.json
CHANGED
package/src/models/asset.js
CHANGED
|
@@ -28,7 +28,7 @@ let asset = function() {
|
|
|
28
28
|
return this.__privates.auth.__client
|
|
29
29
|
.then(client => Promise.all([client, client.apis.asset.initiateAssetUpload({id})]))
|
|
30
30
|
.then(([client, response]) => Promise.all([client, client.http({url: response.data.signedUrl, method: response.data.httpMethod, headers: {"Content-Type":file.type}, body:file}), response.data.id]))
|
|
31
|
-
.then(([client, response, idn]) => client.apis.asset.publishAsset({id:idn}, {requestBody: {title: file.name, ...(roomIds ? {roomIds} : {})}}))
|
|
31
|
+
.then(([client, response, idn]) => Promise.all([client.apis.asset.publishAsset({id:idn}, {requestBody: {title: file.name, ...(roomIds ? {roomIds} : {})}}), idn]))
|
|
32
32
|
;
|
|
33
33
|
},
|
|
34
34
|
downloadAsset: (url, options = {}) => {
|
package/src/models/auth.js
CHANGED
|
@@ -90,6 +90,11 @@ let auth = function () {
|
|
|
90
90
|
.then(client => client.apis.auth.confirmForgotPassword({},{requestBody:{password, confirmationCode, username}}))
|
|
91
91
|
},
|
|
92
92
|
|
|
93
|
+
socialAuth: (data = {}) => {
|
|
94
|
+
return this.__privates.auth.__client
|
|
95
|
+
.then(client => client.apis.auth.socialAuth(data))
|
|
96
|
+
},
|
|
97
|
+
|
|
93
98
|
$on: (key, callback, that) => {
|
|
94
99
|
return this.__privates.auth.on(key, callback, that || this);
|
|
95
100
|
},
|
package/src/models/room.js
CHANGED
|
@@ -23,7 +23,7 @@ let room = function () {
|
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
25
|
|
|
26
|
-
//TODO:
|
|
26
|
+
//TODO:deprecated
|
|
27
27
|
integration: (data = {}) => {
|
|
28
28
|
return this.__privates.auth.__client
|
|
29
29
|
.then(client => client.apis.system.integration({type: this.__instanceType}, {
|
|
@@ -37,7 +37,7 @@ let room = function () {
|
|
|
37
37
|
}));
|
|
38
38
|
},
|
|
39
39
|
|
|
40
|
-
//TODO:
|
|
40
|
+
//TODO:deprecated
|
|
41
41
|
getAnalytics: (data = {}) => {
|
|
42
42
|
return this.__privates.auth.__client
|
|
43
43
|
.then(client => client.apis.system.getAnalytics({instanceType: this.__instanceType, ...data}))
|
package/src/models/system.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
import {serializeError} from "serialize-error";
|
|
4
|
+
|
|
3
5
|
let system = function () {
|
|
4
6
|
return {
|
|
5
7
|
integration: (data = {}) => {
|
|
@@ -38,6 +40,41 @@ let system = function () {
|
|
|
38
40
|
getIntegrationPublic: (type, data = {}) => {
|
|
39
41
|
return this.__privates.auth.__client
|
|
40
42
|
.then(client => client.apis.system.integrationPublic({type}, {requestBody:{...data}}))
|
|
43
|
+
},
|
|
44
|
+
admin: (data = {}) => {
|
|
45
|
+
return this.__privates.auth.__client
|
|
46
|
+
.then(client => client.apis.wt.admin({},{requestBody:{instanceType : this.__instanceType, ...data}}));
|
|
47
|
+
},
|
|
48
|
+
analytics: ({action, startKey = null, limit = 20} = {}) => {
|
|
49
|
+
|
|
50
|
+
let apiParams = {
|
|
51
|
+
action,
|
|
52
|
+
limit,
|
|
53
|
+
...(startKey && {startKey})
|
|
54
|
+
};
|
|
55
|
+
return this.__privates.auth.__client
|
|
56
|
+
.then(client => client.apis.wt.analytics({},{requestBody:{instanceType : this.__instanceType, ...apiParams}}));
|
|
57
|
+
|
|
58
|
+
},
|
|
59
|
+
track: ({eventType = 'ERROR', message} = {}) => {
|
|
60
|
+
return this.__privates.auth.__client
|
|
61
|
+
.then(client => client.apis.wt.track({},{
|
|
62
|
+
requestBody:{
|
|
63
|
+
"eventType": eventType,
|
|
64
|
+
"appType": "web",
|
|
65
|
+
"deviceType": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,
|
|
66
|
+
"os": navigator.platform,
|
|
67
|
+
"browser": navigator.userAgent,
|
|
68
|
+
"domain": location.host,
|
|
69
|
+
"url": location.href,
|
|
70
|
+
"message": serializeError(message)
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
},
|
|
74
|
+
getSchemas: () => {
|
|
75
|
+
return this.__privates.auth.__client.then(client => {
|
|
76
|
+
return client.spec?.components?.schemas
|
|
77
|
+
})
|
|
41
78
|
}
|
|
42
79
|
}
|
|
43
80
|
}
|
package/src/models/user.js
CHANGED
|
@@ -107,8 +107,7 @@ let user = function () {
|
|
|
107
107
|
.then(client => client.apis.user.getUsers(apiParams))
|
|
108
108
|
},
|
|
109
109
|
|
|
110
|
-
//TODO:
|
|
111
|
-
|
|
110
|
+
//TODO:deprecated
|
|
112
111
|
track: ({eventType = 'ERROR', message} = {}) => {
|
|
113
112
|
return this.__privates.auth.__client
|
|
114
113
|
.then(client => client.apis.wt.track({},{
|
|
@@ -125,34 +124,37 @@ let user = function () {
|
|
|
125
124
|
}));
|
|
126
125
|
},
|
|
127
126
|
|
|
128
|
-
//TODO:
|
|
127
|
+
//TODO:deprecated
|
|
129
128
|
getTranslation: ({namespace = 'wt'} = {}) => {
|
|
130
129
|
return this.__privates.auth.__client
|
|
131
130
|
.then(client => client.apis.system.getTranslation({namespace}))
|
|
132
131
|
},
|
|
133
132
|
|
|
134
|
-
//TODO:
|
|
133
|
+
//TODO:deprecated
|
|
135
134
|
getConfig: ({instanceType = this.__instanceType, domain = location.hostname} = {}) => {
|
|
136
135
|
return this.__privates.auth.__client
|
|
137
136
|
.then(client => client.apis.system.getConfig({instanceType, domain}));
|
|
138
137
|
},
|
|
139
138
|
|
|
140
|
-
//TODO:
|
|
139
|
+
//TODO:deprecated
|
|
141
140
|
getIntegrationPublic: (type, data = {}) => {
|
|
142
141
|
return this.__privates.auth.__client
|
|
143
142
|
.then(client => client.apis.system.integrationPublic({type}, {requestBody:{...data}}))
|
|
144
143
|
},
|
|
145
|
-
|
|
144
|
+
|
|
145
|
+
//TODO:deprecated
|
|
146
146
|
updateConfig: (data = {}) => {
|
|
147
147
|
return this.__privates.auth.__client
|
|
148
148
|
.then(client => client.apis.wt.updateConfig({id: data.instanceType || this.__instanceType},{requestBody:{...data}}));
|
|
149
149
|
},
|
|
150
|
-
|
|
150
|
+
|
|
151
|
+
//TODO:deprecated
|
|
151
152
|
admin: (data = {}) => {
|
|
152
153
|
return this.__privates.auth.__client
|
|
153
154
|
.then(client => client.apis.wt.admin({},{requestBody:{instanceType : this.__instanceType, ...data}}));
|
|
154
155
|
},
|
|
155
|
-
|
|
156
|
+
|
|
157
|
+
//TODO:deprecated
|
|
156
158
|
analytics: ({action, startKey = null, limit = 20} = {}) => {
|
|
157
159
|
|
|
158
160
|
let apiParams = {
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
|
|
2
|
+
import {device} from 'aws-iot-device-sdk';
|
|
3
|
+
import emitter from './wt-emitter';
|
|
4
|
+
import {decodeJanusDisplay} from "./wt-utils";
|
|
5
|
+
|
|
6
|
+
class Iot {
|
|
7
|
+
|
|
8
|
+
constructor(enableDebugFlag) {
|
|
9
|
+
Object.assign(this, emitter());
|
|
10
|
+
this.device = null;
|
|
11
|
+
this.decoder = new TextDecoder('utf-8');
|
|
12
|
+
this.connectionActive = false;
|
|
13
|
+
this.log = Iot.noop;
|
|
14
|
+
this.debugFlag = enableDebugFlag;
|
|
15
|
+
this.credentialsExpirationCheckIntervalId = null;
|
|
16
|
+
this.currentCredentialsExpirationStamp = null
|
|
17
|
+
if(enableDebugFlag) {
|
|
18
|
+
this.enableDebug();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static noop() {}
|
|
23
|
+
|
|
24
|
+
enableDebug() {
|
|
25
|
+
this.log = console.log.bind(console);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
startCredentialsExpirationCheck(expiration) {
|
|
29
|
+
this.stopCredentialsExpirationCheck();
|
|
30
|
+
this.currentCredentialsExpirationStamp = new Date(expiration).getTime();
|
|
31
|
+
this.credentialsExpirationCheckIntervalId = setInterval(() => {
|
|
32
|
+
const curentTimeStamp = new Date().getTime();
|
|
33
|
+
if(this.currentCredentialsExpirationStamp - curentTimeStamp <= 300000) {
|
|
34
|
+
this.emit('updateCredentials');
|
|
35
|
+
}
|
|
36
|
+
}, 5000);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
stopCredentialsExpirationCheck() {
|
|
40
|
+
clearInterval(this.credentialsExpirationCheckIntervalId);
|
|
41
|
+
this.credentialsExpirationCheckIntervalId = null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
updateWebSocketCredentials(accessKeyId, secretAccessKey, sessionToken, expiration) {
|
|
45
|
+
if(this.device) {
|
|
46
|
+
this.device.updateWebSocketCredentials(accessKeyId, secretAccessKey, sessionToken);
|
|
47
|
+
this.startCredentialsExpirationCheck(expiration);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
connect(apiMqttUrl, apiMqttClientId, region, accessKeyId, secretAccessKey, sessionToken, expiration, forceDisconnect = false) {
|
|
52
|
+
return this.disconnect(forceDisconnect).then(() => {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
this.device = device({
|
|
55
|
+
protocol:'wss',
|
|
56
|
+
clientId: apiMqttClientId,
|
|
57
|
+
region,
|
|
58
|
+
host: apiMqttUrl,
|
|
59
|
+
accessKeyId: accessKeyId,
|
|
60
|
+
secretKey: secretAccessKey,
|
|
61
|
+
sessionToken: sessionToken,
|
|
62
|
+
keepalive: 15,
|
|
63
|
+
maximumReconnectTimeMs: 8000,
|
|
64
|
+
enableMetrics: false,
|
|
65
|
+
debug: this.debugFlag,
|
|
66
|
+
autoResubscribe: true
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
this.startCredentialsExpirationCheck(expiration);
|
|
70
|
+
|
|
71
|
+
let __s = () => {
|
|
72
|
+
this.device?.off('connect', __s);
|
|
73
|
+
this.device?.off('error', __e);
|
|
74
|
+
resolve(this.device)
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
let __e = (e) => {
|
|
78
|
+
this.device?.off('connect', __s);
|
|
79
|
+
this.device?.off('error', __e);
|
|
80
|
+
reject(e);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.device.once('connect', __s);
|
|
84
|
+
this.device.once('error', __e);
|
|
85
|
+
|
|
86
|
+
this.device.on('message', this.__messageCb.bind(this));
|
|
87
|
+
this.device.on('connect', this.__connectCb.bind(this));
|
|
88
|
+
this.device.on('reconnect', this.__reconnectCb.bind(this));
|
|
89
|
+
this.device.on('error', this.__failureCb.bind(this));
|
|
90
|
+
this.device.on('close', this.__closeCb.bind(this));
|
|
91
|
+
this.device.on('offline', this.__offlineCb.bind(this));
|
|
92
|
+
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
disconnect(force = false) {
|
|
99
|
+
|
|
100
|
+
this.stopCredentialsExpirationCheck();
|
|
101
|
+
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
if(!this.device) {
|
|
104
|
+
resolve();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
let __i = null;
|
|
108
|
+
let __c = () => {
|
|
109
|
+
clearTimeout(__i);
|
|
110
|
+
this.device = null;
|
|
111
|
+
resolve();
|
|
112
|
+
};
|
|
113
|
+
__i = setTimeout(__c, 4000);
|
|
114
|
+
this.device.off('message', this.__messageCb.bind(this));
|
|
115
|
+
this.device.off('connect', this.__connectCb.bind(this));
|
|
116
|
+
this.device.off('reconnect', this.__reconnectCb.bind(this));
|
|
117
|
+
this.device.off('error', this.__failureCb.bind(this));
|
|
118
|
+
this.device.off('close', this.__closeCb.bind(this));
|
|
119
|
+
this.device.off('offline', this.__offlineCb.bind(this));
|
|
120
|
+
this.device.end(force, __c);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
isConnected() {
|
|
125
|
+
return this.connectionActive;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
subscribe(topic) {
|
|
129
|
+
return this.device && this.device.subscribe(topic);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
unsubscribe(topic) {
|
|
133
|
+
return this.device && this.device.unsubscribe(topic);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
send(topic, message) {
|
|
137
|
+
let msg = typeof message === 'object' ? JSON.stringify(message) : message;
|
|
138
|
+
return this.device && this.device.publish(topic, msg);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
__reconnectCb() {
|
|
142
|
+
this.emit('reconnect');
|
|
143
|
+
}
|
|
144
|
+
__connectCb() {
|
|
145
|
+
this.connectionActive = true;
|
|
146
|
+
this.emit('connect');
|
|
147
|
+
}
|
|
148
|
+
__failureCb(err) {
|
|
149
|
+
this.emit('error', err);
|
|
150
|
+
}
|
|
151
|
+
__closeCb(responseObject) {
|
|
152
|
+
this.connectionActive = false;
|
|
153
|
+
this.emit('close');
|
|
154
|
+
}
|
|
155
|
+
__offlineCb(responseObject) {
|
|
156
|
+
this.emit('offline');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
__messageCb(t, message, packet) {
|
|
160
|
+
const topic = t.split('/');
|
|
161
|
+
let payload = JSON.parse(this.decoder.decode(message));
|
|
162
|
+
|
|
163
|
+
if(payload.display) {
|
|
164
|
+
const decodedDisplay = decodeJanusDisplay(payload.display);
|
|
165
|
+
if(decodedDisplay.userId) {
|
|
166
|
+
payload = {...payload, userId: decodedDisplay.userId, role: decodedDisplay.role, start: decodedDisplay.start};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if(topic[0] === 'user') { // user
|
|
171
|
+
const userId = topic[1].replace("_", ':');
|
|
172
|
+
this.emit('message', {userId, ...payload, event: payload.event ? `user:${payload.event}` : 'user'});
|
|
173
|
+
} else if(topic[0] === 'wt') {
|
|
174
|
+
const event = payload.event;
|
|
175
|
+
const roomId = topic[2];
|
|
176
|
+
if(topic[1] === 'room') { // room
|
|
177
|
+
if(
|
|
178
|
+
event === 'message' ||
|
|
179
|
+
event === 'template_updated' ||
|
|
180
|
+
event === 'record_start' ||
|
|
181
|
+
event === 'record_stop' ||
|
|
182
|
+
event === 'record_configured' ||
|
|
183
|
+
event === 'record_livestream_available' ||
|
|
184
|
+
event === 'record_livestream_kick' ||
|
|
185
|
+
event === 'user_update_displayname' ||
|
|
186
|
+
event === 'user_update_avatar' ||
|
|
187
|
+
event === 'user_update_customattributes' ||
|
|
188
|
+
event === 'user_update_privateattributes' ||
|
|
189
|
+
event === 'channel_changed' ||
|
|
190
|
+
event === "instance_homepage_changed" ||
|
|
191
|
+
event === "instance_settings_changed" ||
|
|
192
|
+
event === "externalmix_changed" ||
|
|
193
|
+
event === "video_uploaded" ||
|
|
194
|
+
event === "change_user_devices" ||
|
|
195
|
+
event === "queue" ||
|
|
196
|
+
event === "title_changed"
|
|
197
|
+
) {
|
|
198
|
+
this.emit('message', {event, ...payload, roomId})
|
|
199
|
+
}
|
|
200
|
+
else if(event === 'joined' || event === 'leaving') {
|
|
201
|
+
this.emit('message', {event, ...payload, isObserver:!!payload.isObserver, roomId});
|
|
202
|
+
}
|
|
203
|
+
else if(
|
|
204
|
+
event === 'left' || //user removed room a.k.a. left the room
|
|
205
|
+
event === 'kicked' ||
|
|
206
|
+
event === 'banned' ||
|
|
207
|
+
event === 'unbanned' ||
|
|
208
|
+
event === 'approved' ||
|
|
209
|
+
event === 'muted' ||
|
|
210
|
+
event === 'unmuted' ||
|
|
211
|
+
event === 'messageRemoved' ||
|
|
212
|
+
event === 'messageReported' ||
|
|
213
|
+
event === 'chatClear' ||
|
|
214
|
+
event === 'handRaised' || event === 'handLowered' || event === 'handsCleared'
|
|
215
|
+
) {
|
|
216
|
+
this.emit('message', {event, ...payload});
|
|
217
|
+
}
|
|
218
|
+
else if(event === 'volume_set') {
|
|
219
|
+
this.emit('message', {event, ...payload});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else if(topic[1] === 'instanceroom') { // instance
|
|
223
|
+
if(event === 'add_room' || event === 'remove_room' || event === 'set_room' || event === "instance_homepage_changed" || event === 'instance_settings_changed') {
|
|
224
|
+
this.emit('message', {event, ...payload});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else if(topic[1] === 'externalmix') {
|
|
228
|
+
const event = payload.event;
|
|
229
|
+
this.emit('message', {event, ...payload});
|
|
230
|
+
}
|
|
231
|
+
} else if(topic[0] === 'wtr') {
|
|
232
|
+
const recorderId = topic[1];
|
|
233
|
+
const sessionId = topic[2];
|
|
234
|
+
if(topic[3] === 'control') {
|
|
235
|
+
this.emit('message', {event: 'recorder_control', ...payload, recorderId, sessionId});
|
|
236
|
+
} // recorder control
|
|
237
|
+
else if(topic[3] === 'monitor') {
|
|
238
|
+
this.emit('message', {event: 'recorder_monitor', ...payload, recorderId, sessionId});
|
|
239
|
+
} // recorder monitor
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
export default Iot;
|
package/src/modules/wt-iot.js
CHANGED
|
@@ -228,6 +228,9 @@ class Iot {
|
|
|
228
228
|
const event = payload.event;
|
|
229
229
|
this.emit('message', {event, ...payload});
|
|
230
230
|
}
|
|
231
|
+
else if(topic[1] === 'asset') {
|
|
232
|
+
this.emit('message', {event: 'asset', assetId: topic[2], ...payload});
|
|
233
|
+
}
|
|
231
234
|
} else if(topic[0] === 'wtr') {
|
|
232
235
|
const recorderId = topic[1];
|
|
233
236
|
const sessionId = topic[2];
|