Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda