ADd host param to reader example

This commit is contained in:
haad 2016-02-29 12:50:27 +01:00
parent 5481334220
commit 7b68e2648a

View File

@ -5,23 +5,24 @@ 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>
// 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';
const password = ''; const password = '';
const prefix = process.argv[4] ? process.argv[4] : 'LambOfGod'; const prefix = process.argv[5] ? process.argv[5] : 'Hello';
let run = (async(() => { let run = (async(() => {
try { try {
var orbit = OrbitClient.connect(host, port, username, password); var orbit = OrbitClient.connect(host, port, username, password);
const c1 = process.argv[2] ? process.argv[2] : 'c1'; const channelName = process.argv[4] ? process.argv[4] : 'test';
const channel = orbit.channel(c1); const channel = orbit.channel(channelName);
let count = 1; let count = 1;
let id = 'Log: Query '
let running = false; let running = false;
setInterval(async(() => { setInterval(async(() => {