Giter VIP home page Giter VIP logo

node-native-messaging-host's Introduction

Simple Node Native Messaging Host

A native messaging host for Chrome and Firefox with a simple API and no dependencies.

Install

npm i node-native-messaging-host

Usage

import initNativeMessagingHost from 'node-native-messaging-host';

// Initialize
const nm = initNativeMessagingHost();

// Add a callback that will be fired each time a new message is
// received from the extension.
nm.addOnMessageListener(message => {
    console.log(`Received ${message} from extension`);
});


// Send a message to the extension
nm.send({ answer: 42 });

Used by

Todo

  • tests

node-native-messaging-host's People

Contributors

pyrho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

saboya

node-native-messaging-host's Issues

Exception connecting

I'm trying to connect to the app example of the Readme.

In the browser console I see:

JSON.parse: expected property name or '}' at line 1 column 3 of the JSON data 2 subprocess_common.jsm:493
    readJSON resource://gre/modules/subprocess/subprocess_common.jsm:493

And this stderr output from native app:

internal/buffer.js:79
    throw new ERR_BUFFER_OUT_OF_BOUNDS();
    ^

RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds
    at boundsError (internal/buffer.js:79:11)
    at Buffer.readUInt32LE (internal/buffer.js:215:5)
    at processData ([...]/node_modules/node-native-messaging-host/index.js:38:42)

Any insight would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.