@iobroker/socket-classes 0.1.6 → 0.1.7
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/README.md +3 -0
- package/lib/socketAdmin.js +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/socketAdmin.js
CHANGED
|
@@ -140,10 +140,12 @@ class SocketAdmin extends SocketCommon {
|
|
|
140
140
|
stateChange(id, state) {
|
|
141
141
|
this.commands.stateChange(id, state);
|
|
142
142
|
|
|
143
|
-
this.server.sockets
|
|
144
|
-
this.
|
|
143
|
+
if (this.server && this.server.sockets) {
|
|
144
|
+
this.server.sockets.connected.forEach(socket =>
|
|
145
|
+
this.__updateSession(socket));
|
|
145
146
|
|
|
146
|
-
|
|
147
|
+
this.server.sockets.emit('stateChange', id, state);
|
|
148
|
+
}
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
repoUpdated() {
|
|
@@ -153,15 +155,17 @@ class SocketAdmin extends SocketCommon {
|
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
objectChange(id, obj) {
|
|
156
|
-
|
|
158
|
+
if (this.server && this.server.sockets) {
|
|
159
|
+
const clients = this.server.sockets.connected;
|
|
157
160
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
for (const i in clients) {
|
|
162
|
+
if (clients.hasOwnProperty(i)) {
|
|
163
|
+
this.__updateSession(clients[i]);
|
|
164
|
+
}
|
|
161
165
|
}
|
|
162
|
-
}
|
|
163
166
|
|
|
164
|
-
|
|
167
|
+
this.server.sockets.emit('objectChange', id, obj);
|
|
168
|
+
}
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
subscribe(type, pattern) {
|