@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 CHANGED
@@ -69,6 +69,9 @@ io.close();
69
69
  -->
70
70
 
71
71
  ## Changelog
72
+ ### 0.1.7 (2022-05-05)
73
+ * (bluefox) Caught some sentry errors
74
+
72
75
  ### 0.1.6 (2022-05-05)
73
76
  * (bluefox) fixed `delObject` command
74
77
 
@@ -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.connected.forEach(socket =>
144
- this.__updateSession(socket));
143
+ if (this.server && this.server.sockets) {
144
+ this.server.sockets.connected.forEach(socket =>
145
+ this.__updateSession(socket));
145
146
 
146
- this.server.sockets.emit('stateChange', id, state);
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
- const clients = this.server.sockets.connected;
158
+ if (this.server && this.server.sockets) {
159
+ const clients = this.server.sockets.connected;
157
160
 
158
- for (const i in clients) {
159
- if (clients.hasOwnProperty(i)) {
160
- this.__updateSession(clients[i]);
161
+ for (const i in clients) {
162
+ if (clients.hasOwnProperty(i)) {
163
+ this.__updateSession(clients[i]);
164
+ }
161
165
  }
162
- }
163
166
 
164
- this.server.sockets.emit('objectChange', id, obj);
167
+ this.server.sockets.emit('objectChange', id, obj);
168
+ }
165
169
  }
166
170
 
167
171
  subscribe(type, pattern) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/socket-classes",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "ioBroker server-side web sockets",
5
5
  "author": {
6
6
  "name": "bluefox",