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

235
Vistas
Firefox extension can recieve messages via native messaging, but sending messages doesn't seem to work

I'm working on a Firefox extension with a Node.js script as a native messaging host. Messages sent to the extension from the script are recieved as expected, but every method I have tried to listen for messages from the extension have failed.

I have tried using stdin:

process.stdin.on('readable', function() {
  let message = JSON.stringify("hello");
  sendMessage(`{"test": "${message}"}`);
});

This works fine if I run the script from the command line but it will never pick up messages sent from the extension itself.

I have also tried the npm native-messaging host protocol, based closely on the example:

var sendMessage = require('native-messaging')(handleMessage)
 
function handleMessage (req) {
    fs.writeFile('test.txt', req.message, err => {
    if (err) {
        console.error(err);
    }
    // file written successfully
    }); 
    sendMessage({message: "pong", body: 'hello from nodejs app'});
}

This also yields no result.

I have tested both methods and neither of these functions seem to ever be called, no matter how many times I send a message from the extension, and no errors are thrown.

I don't believe this is a problem with the manifest or the registry keys, because messaging seems to work fine one way.

Why are my messages not being received by the script?


Native Messaging documentation by MDN

npm Native Messaging

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