Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

250
Views
Passing Websocket to ChildProcess NodeJS

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!