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

238
Views
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
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!