@iobroker/socket-classes 0.4.4 → 0.4.5
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/socketCommon.js +16 -0
- package/package.json +1 -1
package/README.md
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
|
}
|