I've tried so many different things to get this to work but for the life of me can't get this past nodeJS. Im trying to pass my websocket connection directly to a forked childProcess. Whenever I try to pass either the ws socket instance like so:
this._wsServer.on('connection', (p_client: WebSocket) => {
this._handleConnection(p_client, p_socket);
});
this.childProcess.send({}, p_client);
we get the following error:
TypeError [ERR_INVALID_HANDLE_TYPE]: This handle type cannot be sent
at new NodeError (internal/errors.js:322:7)
at ChildProcess.target._send (internal/child_process.js:768:15)
at ChildProcess.target.send (internal/child_process.js:712:19)
at OcxWebsocketServer._startProcess (C:\Sebas\GITDev\oceanex-js_dev\oceanex-js\dist\apps\portal-back-ws\main.js:232:37)
at WebSocket.<anonymous> (C:\Sebas\GITDev\oceanex-js_dev\oceanex-js\dist\apps\portal-back-ws\main.js:370:26)
at WebSocket.emit (events.js:400:28)
at Receiver.receiverOnMessage (C:\Sebas\GITDev\oceanex-js_dev\oceanex-js\node_modules\ws\lib\websocket.js:1137:20)
at Receiver.emit (events.js:400:28)
at Receiver.dataMessage (C:\Sebas\GITDev\oceanex-js_dev\oceanex-js\node_modules\ws\lib\receiver.js:528:14)
at Receiver.getData (C:\Sebas\GITDev\oceanex-js_dev\oceanex-js\node_modules\ws\lib\receiver.js:446:17) {
code: 'ERR_INVALID_HANDLE_TYPE'
}
Ive also tried to use this solution and pass a https socket directly to the child but I get the same type error even though im not using a ws websocket instance but a pure https connection.
Any help with this would be extremely appreciated
Thanks, Michael