Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

260
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda