Update README and examples
This commit is contained in:
parent
00db5728e9
commit
2c4381e7d5
11
README.md
11
README.md
@ -21,13 +21,18 @@ npm install
|
|||||||
|
|
||||||
Key-Value store example:
|
Key-Value store example:
|
||||||
```
|
```
|
||||||
node examples/keyvalue.js <channel> <username> <key> <value>
|
node examples/keyvalue.js <host> <username> <channel> <key> <value>
|
||||||
node examples/keyvalueReader.js <channel> <username> <key>
|
node examples/keyvalueReader.js <host> <username> <channel> <key>
|
||||||
```
|
```
|
||||||
|
|
||||||
Event log example (run several in separate shells):
|
Event log example (run several in separate shells):
|
||||||
```
|
```
|
||||||
node examples/reader.js <channel> <username> <data> <interval in ms>
|
node examples/reader.js <host> <username> <channel> <data> <interval in ms>
|
||||||
|
```
|
||||||
|
|
||||||
|
Benchmark writes:
|
||||||
|
```
|
||||||
|
node examples/benchmark.js <host> <username> <channel>;
|
||||||
```
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
@ -5,8 +5,10 @@ const await = require('asyncawait/await');
|
|||||||
const OrbitClient = require('../src/OrbitClient');
|
const OrbitClient = require('../src/OrbitClient');
|
||||||
const Timer = require('./Timer');
|
const Timer = require('./Timer');
|
||||||
|
|
||||||
|
// usage: keyvalue.js <host> <username> <channel> <key> <value>
|
||||||
|
|
||||||
// orbit-server
|
// orbit-server
|
||||||
const host = 'localhost';
|
const host = process.argv[2] ? process.argv[2] : 'localhost'
|
||||||
const port = 3333;
|
const port = 3333;
|
||||||
|
|
||||||
const username = process.argv[3] ? process.argv[3] : 'LambOfGod';
|
const username = process.argv[3] ? process.argv[3] : 'LambOfGod';
|
||||||
@ -15,14 +17,14 @@ const password = '';
|
|||||||
let run = (async(() => {
|
let run = (async(() => {
|
||||||
try {
|
try {
|
||||||
const orbit = OrbitClient.connect(host, port, username, password);
|
const orbit = OrbitClient.connect(host, port, username, password);
|
||||||
const channel = process.argv[2] ? process.argv[2] : 'testing123';
|
const channel = process.argv[4] ? process.argv[4] : 'testing123';
|
||||||
const db = orbit.channel(channel);
|
const db = orbit.channel(channel);
|
||||||
|
|
||||||
let count = 1;
|
let count = 1;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
const key = process.argv[4] ? process.argv[4] : 'greeting';
|
const key = process.argv[5] ? process.argv[5] : 'greeting';
|
||||||
const value = process.argv[5] ? process.argv[5] : 'Hello world';
|
const value = process.argv[6] ? process.argv65] : 'Hello world';
|
||||||
const timer = new Timer(true);
|
const timer = new Timer(true);
|
||||||
db.put(key, value + " " + count);
|
db.put(key, value + " " + count);
|
||||||
const result = db.get(key);
|
const result = db.get(key);
|
||||||
|
@ -5,8 +5,10 @@ const await = require('asyncawait/await');
|
|||||||
const OrbitClient = require('../src/OrbitClient');
|
const OrbitClient = require('../src/OrbitClient');
|
||||||
const Timer = require('./Timer');
|
const Timer = require('./Timer');
|
||||||
|
|
||||||
|
// usage: keyvalueReader.js <host> <username> <channel> <key>
|
||||||
|
|
||||||
// orbit-server
|
// orbit-server
|
||||||
const host = 'localhost';
|
const host = process.argv[2] ? process.argv[2] : 'localhost'
|
||||||
const port = 3333;
|
const port = 3333;
|
||||||
|
|
||||||
const username = process.argv[3] ? process.argv[3] : 'LambOfGod';
|
const username = process.argv[3] ? process.argv[3] : 'LambOfGod';
|
||||||
@ -15,13 +17,13 @@ const password = '';
|
|||||||
let run = (async(() => {
|
let run = (async(() => {
|
||||||
try {
|
try {
|
||||||
const orbit = OrbitClient.connect(host, port, username, password);
|
const orbit = OrbitClient.connect(host, port, username, password);
|
||||||
const channel = process.argv[2] ? process.argv[2] : 'testing123';
|
const channel = process.argv[4] ? process.argv[4] : 'testing123';
|
||||||
const db = orbit.channel(channel);
|
const db = orbit.channel(channel);
|
||||||
|
|
||||||
let count = 1;
|
let count = 1;
|
||||||
|
|
||||||
setInterval(async(() => {
|
setInterval(async(() => {
|
||||||
const key = process.argv[4] ? process.argv[4] : 'greeting';
|
const key = process.argv[5] ? process.argv[5] : 'greeting';
|
||||||
let timer = new Timer(true);
|
let timer = new Timer(true);
|
||||||
const result = db.get(key);
|
const result = db.get(key);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ const await = require('asyncawait/await');
|
|||||||
const OrbitClient = require('../src/OrbitClient');
|
const OrbitClient = require('../src/OrbitClient');
|
||||||
const Timer = require('./Timer');
|
const Timer = require('./Timer');
|
||||||
|
|
||||||
// usage: reader.js <host> <username> <channel> <text> <interval>
|
// usage: reader.js <host> <username> <channel> <data> <interval in ms>
|
||||||
|
|
||||||
// orbit-server
|
// orbit-server
|
||||||
const host = process.argv[2] ? process.argv[2] : 'localhost'
|
const host = process.argv[2] ? process.argv[2] : 'localhost'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user