@reactoo/watchtogether-sdk-js 2.7.58 → 2.7.59
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/package.json
CHANGED
package/src/models/room.js
CHANGED
|
@@ -87,10 +87,6 @@ let room = function () {
|
|
|
87
87
|
}))
|
|
88
88
|
},
|
|
89
89
|
|
|
90
|
-
updateAttribute: () => {
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
|
|
94
90
|
updateRoom: ({roomId, title, description, isPublic, isRouter, recordings, slug, password, maxParticipants, setInstanceType = false, wtChannelId, isHd, isStudioLayout, hasStudioChat, reduceRoomControls, chatRoomId, linkedRoomId, type, disableSync, defaultRegion, isSimulcast, videoCodec, customAttributes, dotAttribute} = {}) => {
|
|
95
91
|
let _da = dotAttribute
|
|
96
92
|
? (Array.isArray(dotAttribute)
|
|
@@ -154,6 +150,19 @@ let room = function () {
|
|
|
154
150
|
}))
|
|
155
151
|
},
|
|
156
152
|
|
|
153
|
+
updateAttribute: ({roomId, id, operation, attributeName, value}) => {
|
|
154
|
+
return this.__privates.auth.__client
|
|
155
|
+
.then(client => client.apis.wt.updateAttribute({}, {
|
|
156
|
+
requestBody: {
|
|
157
|
+
id,
|
|
158
|
+
roomId,
|
|
159
|
+
operation,
|
|
160
|
+
attributeName,
|
|
161
|
+
value,
|
|
162
|
+
}
|
|
163
|
+
}))
|
|
164
|
+
},
|
|
165
|
+
|
|
157
166
|
getInviteUrl: ({roomId, domain, url, autologin}) => {
|
|
158
167
|
return this.__privates.auth.__client
|
|
159
168
|
.then(client => client.apis.wt.invite({}, {
|
|
@@ -2,7 +2,7 @@ import { mqtt, iot } from 'aws-iot-device-sdk-v2';
|
|
|
2
2
|
console.log('Worker: Starting up');
|
|
3
3
|
|
|
4
4
|
let connection = null;
|
|
5
|
-
let currentConnectionId =
|
|
5
|
+
let currentConnectionId = 1;
|
|
6
6
|
|
|
7
7
|
self.onmessage = function(event) {
|
|
8
8
|
const { type, params, topic, message } = event.data;
|
|
@@ -52,8 +52,8 @@ function connect(params) {
|
|
|
52
52
|
const client = new mqtt.MqttClient();
|
|
53
53
|
|
|
54
54
|
connection = client.new_connection(config);
|
|
55
|
-
//
|
|
56
|
-
currentConnectionId
|
|
55
|
+
// increment connection id
|
|
56
|
+
currentConnectionId++;
|
|
57
57
|
|
|
58
58
|
setupConnectionListeners(currentConnectionId);
|
|
59
59
|
|
|
@@ -74,14 +74,14 @@ function disconnect() {
|
|
|
74
74
|
connection.disconnect()
|
|
75
75
|
.then(() => {
|
|
76
76
|
if(connectionId !== currentConnectionId) {
|
|
77
|
-
console.log('Worker: Connection Id mismatch, ignoring disconnect result');
|
|
77
|
+
console.log('Worker: Connection Id mismatch, ignoring disconnect result', connectionId, currentConnectionId);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
self.postMessage({ type: 'disconnect_result', data: {success: true} });
|
|
81
81
|
})
|
|
82
82
|
.catch((error) => {
|
|
83
83
|
if(connectionId !== currentConnectionId) {
|
|
84
|
-
console.log('Worker: Connection Id mismatch, ignoring disconnect result');
|
|
84
|
+
console.log('Worker: Connection Id mismatch, ignoring disconnect result', connectionId, currentConnectionId);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
self.postMessage({ type: 'disconnect_result', data: { success: false, error: error.message} });
|
|
@@ -136,7 +136,7 @@ function send(topic, message) {
|
|
|
136
136
|
function setupConnectionListeners(connectionId) {
|
|
137
137
|
connection.on('connect', () => {
|
|
138
138
|
if(connectionId !== currentConnectionId) {
|
|
139
|
-
console.log('Worker: Connection Id mismatch, ignoring connect event');
|
|
139
|
+
console.log('Worker: Connection Id mismatch, ignoring connect event', connectionId, currentConnectionId);
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
self.postMessage({ type: 'connect', connectionId: connectionId});
|
|
@@ -144,7 +144,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
144
144
|
|
|
145
145
|
connection.on('disconnect', () => {
|
|
146
146
|
if(connectionId !== currentConnectionId) {
|
|
147
|
-
console.log('Worker: Connection Id mismatch, ignoring disconnect event');
|
|
147
|
+
console.log('Worker: Connection Id mismatch, ignoring disconnect event', connectionId, currentConnectionId);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
self.postMessage({ type: 'disconnect', connectionId: connectionId });
|
|
@@ -152,7 +152,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
152
152
|
|
|
153
153
|
connection.on('error', (error) => {
|
|
154
154
|
if(connectionId !== currentConnectionId) {
|
|
155
|
-
console.log('Worker: Connection Id mismatch, ignoring error event');
|
|
155
|
+
console.log('Worker: Connection Id mismatch, ignoring error event', connectionId, currentConnectionId);
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
self.postMessage({ type: 'error', data: error });
|
|
@@ -160,7 +160,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
160
160
|
|
|
161
161
|
connection.on('interrupt', (error) => {
|
|
162
162
|
if(connectionId !== currentConnectionId) {
|
|
163
|
-
console.log('Worker: Connection Id mismatch, ignoring interrupt event');
|
|
163
|
+
console.log('Worker: Connection Id mismatch, ignoring interrupt event', connectionId, currentConnectionId);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
self.postMessage({ type: 'interrupt', data: error, connectionId: connectionId });
|
|
@@ -168,7 +168,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
168
168
|
|
|
169
169
|
connection.on('resume', (error) => {
|
|
170
170
|
if(connectionId !== currentConnectionId) {
|
|
171
|
-
console.log('Worker: Connection Id mismatch, ignoring resume event');
|
|
171
|
+
console.log('Worker: Connection Id mismatch, ignoring resume event', connectionId, currentConnectionId);
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
self.postMessage({ type: 'resume', data: error, connectionId: connectionId });
|
|
@@ -176,7 +176,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
176
176
|
|
|
177
177
|
connection.on('message', (topic, payload) => {
|
|
178
178
|
if(connectionId !== currentConnectionId) {
|
|
179
|
-
console.log('Worker: Connection Id mismatch, ignoring message event');
|
|
179
|
+
console.log('Worker: Connection Id mismatch, ignoring message event', connectionId, currentConnectionId);
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
self.postMessage({ type: 'message', data: { topic, payload }, connectionId: connectionId });
|
|
@@ -184,7 +184,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
184
184
|
|
|
185
185
|
connection.on('connection_success', (error) => {
|
|
186
186
|
if(connectionId !== currentConnectionId) {
|
|
187
|
-
console.log('Worker: Connection Id mismatch, ignoring connection_success event');
|
|
187
|
+
console.log('Worker: Connection Id mismatch, ignoring connection_success event', connectionId, currentConnectionId);
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
self.postMessage({ type: 'connection_success', data: error, connectionId: connectionId });
|
|
@@ -192,7 +192,7 @@ function setupConnectionListeners(connectionId) {
|
|
|
192
192
|
|
|
193
193
|
connection.on('connection_failure', (error) => {
|
|
194
194
|
if(connectionId !== currentConnectionId) {
|
|
195
|
-
console.log('Worker: Connection Id mismatch, ignoring connection_failure event');
|
|
195
|
+
console.log('Worker: Connection Id mismatch, ignoring connection_failure event', connectionId, currentConnectionId);
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
198
|
self.postMessage({ type: 'connection_failure', data: error, connectionId: connectionId });
|