0.4.0 • Published 5 years ago

verdon v0.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Verdon NPM version Build status Coverage status

Avro services utilities.

Proxies

Sample Avro remote logging service running behind a WebSocket server:

const avro = require('avsc');
const http = require('http');
const verdon = require('verdon');

const protocol = avro.readProtocol(`
  protocol RemoteLogService {
    enum Level { DEBUG, INFO, WARNING }
    void log(Level level, string message);
  }
`);

const logServer = avro.Service.forProtocol(protocol).createServer()
  .onLog(function (level, msg) { console.log(`${level}: ${msg}`); });

const proxy = verdon.createProxy().bindServer(logServer);

http.createServer()
  .on('upgrade', proxy.webSocketHandler())
  .listen(8080);

And a corresponding client:

const avro = require('avsc');
const ws = require('websocket-stream');

const protocol = avro.readProtocol(`
  protocol RemoteLogService {
    void log(enum { INFO, WARNING } level, string message);
  }
`);

const logClient = avro.Service.forProtocol(protocol)
  .createClient({buffering: true, transport: ws('ws://localhost:8080')});

logClient.log('INFO', 'We are now live!');

setTimeout(function () {
  logClient.log('WARNING', 'And soon we will not.');
  logClient.destroyChannels();
}, 1000);
0.4.0

5 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago