Nozzle Piping Mismatch

    verdon

    0.4.0 • Public • Published

    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);

    Keywords

    Install

    npm i verdon

    DownloadsWeekly Downloads

    1

    Version

    0.4.0

    License

    MIT

    Unpacked Size

    24.5 kB

    Total Files

    7

    Last publish

    Collaborators

    • mtth