RVI Node.js Client
Node.js websocket client for interacting with an RVI node.
Features
- Register services with RVI node.
- Invoke remote services.
- Auto-reconnect to recover from broken connections or RVI node downtime.
- Consume and handle errors gracefully.
- Configurable to handle various use cases.
- Built in logging with bunyan.
Getting Started
- Install package:
npm install rvi
- Connect to an RVI node, register, and call a service:
var RVI = ; var rvi = 'localhost:5000'; // Registers the service at the RVI node with given callback.rvi; // The service must be prefixed with the node prefix set in the RVI configrvi;
API Reference
View full API reference and examples at: doc/rvi.md
.
Development
To develop on the rvi node client, clone this repo. The following commands will be useful while developing:
Setup
Install all dependencies.
npm install
Testing and Coverage
Run unit tests. The tests use port 4000 to create a web socket server. Ensure nothing is running on that port when testing.
npm test
Run test coverage. For detailed line output, open coverage/lcov-report/index.html
in a web browser.
npm run cover
Linting and Style
Uses JSHint to check for correctness.
npm run lint
Uses JSCS to enforce consistent code style.
npm run style
Documentation
Generate API reference from inline JSDoc, outputed at doc/rvi.md
.
npm run doc