@iobroker/socket-classes 0.4.3 → 0.4.6
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 +9 -0
- package/lib/socketCommands.js +4 -0
- package/lib/socketCommon.js +17 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,6 +69,15 @@ io.close();
|
|
|
69
69
|
-->
|
|
70
70
|
|
|
71
71
|
## Changelog
|
|
72
|
+
### 0.4.6 (2022-06-20)
|
|
73
|
+
* (bluefox) updated `passport`
|
|
74
|
+
|
|
75
|
+
### 0.4.5 (2022-06-20)
|
|
76
|
+
* (bluefox) allow to run socket.io behind reverse proxy
|
|
77
|
+
|
|
78
|
+
### 0.4.4 (2022-06-09)
|
|
79
|
+
* (bluefox) Do not show requireLog message
|
|
80
|
+
|
|
72
81
|
### 0.4.3 (2022-06-03)
|
|
73
82
|
* (bluefox) Allowed call of getAdapterInstances for non admin
|
|
74
83
|
|
package/lib/socketCommands.js
CHANGED
package/lib/socketCommon.js
CHANGED
|
@@ -75,6 +75,10 @@ class SocketCommon {
|
|
|
75
75
|
this.server = socketClass(server, socketOptions);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
if (typeof this.server.of === 'function') {
|
|
79
|
+
this.allNamespaces = this.server.of(/.*/);
|
|
80
|
+
}
|
|
81
|
+
|
|
78
82
|
server.__inited = true;
|
|
79
83
|
this.adapter.log.info(`${this.settings.secure ? 'Secure ' : ''}socket.io server listening on port ${this.settings.port}`);
|
|
80
84
|
}
|
|
@@ -93,6 +97,11 @@ class SocketCommon {
|
|
|
93
97
|
this.eventHandlers.connect && this.eventHandlers.connect(socket);
|
|
94
98
|
this._initSocket(socket, cb);
|
|
95
99
|
});
|
|
100
|
+
// support of dynamic namespaces (because of reverse proxy)
|
|
101
|
+
this.allNamespaces && this.allNamespaces.on('connection', (socket, cb) => {
|
|
102
|
+
this.eventHandlers.connect && this.eventHandlers.connect(socket);
|
|
103
|
+
this._initSocket(socket, cb);
|
|
104
|
+
});
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
this.server.on('error', (error, details) => {
|
|
@@ -101,6 +110,13 @@ class SocketCommon {
|
|
|
101
110
|
this.adapter.log.error(`Error: ${(error && error.message) || JSON.stringify(error)}${details ? ' - ' + details : ''}`);
|
|
102
111
|
}
|
|
103
112
|
});
|
|
113
|
+
// support of dynamic namespaces (because of reverse proxy)
|
|
114
|
+
this.allNamespaces && this.allNamespaces.on('error', (error, details) => {
|
|
115
|
+
// ignore "failed connection" as it already shown
|
|
116
|
+
if (!error || !error.message || !error.message.includes('failed connection')) {
|
|
117
|
+
this.adapter.log.error(`Error: ${(error && error.message) || JSON.stringify(error)}${details ? ' - ' + details : ''}`);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
104
120
|
|
|
105
121
|
this._updateConnectedInfo();
|
|
106
122
|
}
|
|
@@ -266,7 +282,7 @@ class SocketCommon {
|
|
|
266
282
|
this._updateConnectedInfo();
|
|
267
283
|
|
|
268
284
|
// Disable logging if no one browser is connected
|
|
269
|
-
if (this.adapter.requireLog) {
|
|
285
|
+
if (this.adapter.requireLog && this.commands && this.commands.isLogEnabled()) {
|
|
270
286
|
this.adapter.log.debug('Disable logging, because no one socket connected');
|
|
271
287
|
this.adapter.requireLog(!!(this.server && this.server.engine && this.server.engine.clientsCount));
|
|
272
288
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/socket-classes",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "ioBroker server-side web sockets",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://github.com/ioBroker/ioBroker.socket-classes"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"passport": "^0.
|
|
24
|
+
"passport": "^0.6.0",
|
|
25
25
|
"cookie-parser": "^1.4.6",
|
|
26
26
|
"axios": "^0.27.2"
|
|
27
27
|
},
|