https://github.com/getstation/native-messaging-client
https://github.com/getstation/native-messaging-client
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/getstation/native-messaging-client
- Owner: getstation
- License: mit
- Created: 2017-12-06T14:50:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-06T15:17:46.000Z (over 8 years ago)
- Last Synced: 2025-12-30T02:15:46.898Z (6 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Native Messaging Client
==========
Communicate with apps trough the Native Messaging API
Install
-------
```bash
npm install native-messaging-client --save
```
Usage examples
--------------
##### Example
```js
const demo = async () => {
const client = await Client('com.google.chrome.example.echo').connect();
if (client.isConnected) {
client.streamOut.on('data', msg => { console.log('event streamOut data', msg.toString()) });
client.streamErr.on('data', msg => { console.log('event streamErr data', msg.toString()) });
client.hostProcess.on('exit', (code, signal) => { console.log('event exit', code, signal) });
client.hostProcess.on('close', (code, signal) => { console.log('event close', code, signal) });
client.hostProcess.on('disconnect', () => { console.log('event disconnect') });
client.send('my message');
setTimeout(() => {
client.close();
}, 10000)
}
};
demo();
```
## Todo
- [ ] client singleton with multiple processes
- [ ] better buffer management for long messages
- [ ] tests
## License
[MIT](https://github.com/hugomano/native-messaging-client/blob/master/LICENSE)