Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baslr/arangochair
🥑 arangochair is a Node.js module that adds changefeed capability to ArangoDB and make it realtime push ready
https://github.com/baslr/arangochair
arangochair arangodb changefeed push realtime subscribe
Last synced: 22 days ago
JSON representation
🥑 arangochair is a Node.js module that adds changefeed capability to ArangoDB and make it realtime push ready
- Host: GitHub
- URL: https://github.com/baslr/arangochair
- Owner: baslr
- Created: 2016-10-10T22:09:15.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-28T14:11:06.000Z (over 5 years ago)
- Last Synced: 2024-11-18T10:34:19.205Z (26 days ago)
- Topics: arangochair, arangodb, changefeed, push, realtime, subscribe
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 91
- Watchers: 11
- Forks: 19
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-arangodb - arangochair - Pushes ArangoDB changes in realtime to the client. (Uncategorized / Uncategorized)
README
# arangochair
`arangochair` pushs ArangoDB changes in realtime to you.
## install
```bash
npm install --save arangochair
```## quick example
```es6
const arangochair = require('arangochair');const no4 = new arangochair('http://127.0.0.1:8529/'); // ArangoDB node to monitor
const no4 = new arangochair('http://127.0.0.1:8529/myDb'); // ArangoDB node to monitor, with database name
no4.subscribe({collection:'users'});
no4.start();
no4.on('users', (doc, type) => {
// do something awesome// doc:Buffer
// type:'insert/update'|'delete'
});no4.on('error', (err, httpStatus, headers, body) => {
// arangochair stops on errors
// check last http request
no4.start();
});
```## subscribe
```es6
// subscribe to all events in the users collection
no4.subscribe('users');// explicit
no4.subscribe({collection:'users', events:['insert/update', 'delete']});// subscribe the users collection with only the delete event
no4.subscribe({collection:'users', events:['delete']});// subscribe the users collection with only the delete event on key myKey
no4.subscribe({collection:'users', events:['delete'], keys:['myKey']});
```## unsubscribe
```es6
// unsubscribe the users collection
no4.unsubscribe('users');// unsubscribe the delete event in the users collection
no4.unsubscribe({collection:'users',events:['delete']});// unsubscribe the key myKey in the users collection
no4.unsubscribe({collection:'users',keys:['myKey']});
```