@es-labs/jslib 0.0.1 → 0.0.2
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/CHANGELOG.md +3 -0
- package/package.json +1 -1
- package/services/index.js +1 -1
- package/services/websocket.js +11 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/services/index.js
CHANGED
|
@@ -9,7 +9,7 @@ let servicesConfig = []
|
|
|
9
9
|
const services = {}
|
|
10
10
|
|
|
11
11
|
const start = async (
|
|
12
|
-
config = JSON.parse(process.env.SERVICES_CONFIG || null) || []
|
|
12
|
+
app, server, config = JSON.parse(process.env.SERVICES_CONFIG || null) || []
|
|
13
13
|
) => {
|
|
14
14
|
const serviceTypesAvailable = process.env.SERVICES_TYPES_AVAILABLE.split(',')
|
|
15
15
|
try {
|
package/services/websocket.js
CHANGED
|
@@ -92,8 +92,18 @@ export default class Wss {
|
|
|
92
92
|
if (!server) this._wss = new WebSocketServer({ port: this._port }) // use seperate port
|
|
93
93
|
else this._wss = new WebSocketServer({ server })
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
|
|
96
|
+
// This caused header to fire twice
|
|
97
|
+
// if (app) server.on('request', app)
|
|
96
98
|
|
|
99
|
+
// new WebSocketServer({ server }) - no need to handle upgrade event, ws will handle it internally
|
|
100
|
+
// server.on('upgrade', (req, socket, head) => {
|
|
101
|
+
// console.log('WS Upgrade Request Rexeived !!!')
|
|
102
|
+
// this._wss.handleUpgrade(req, socket, head, (ws) => {
|
|
103
|
+
// this._wss.emit('connection', ws, req);
|
|
104
|
+
// });
|
|
105
|
+
// });
|
|
106
|
+
|
|
97
107
|
console.log('WS API listening on port ' + this._port)
|
|
98
108
|
if (this._wss) {
|
|
99
109
|
this._wss.on('connection', (ws) => {
|