Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    rivulet_clientpublic

    Rivulet Client

    Build Status

    NPM

    NPM

    Allows you to connect to a Journeyman server with Rivulet. Use with browserify for client side code.

    Server

     
    var Journeyman = require('journeyman');
    var Rivulet = require('rivulet');
     
    var server = new Journeyman(3000);
    var rivulet = new Rivulet();
     
    server.listen();
     
    rivulet.send("boom", { name: 'brandon' });
    rivulet.send("boom", { name: 'ted' }, 'private');
     

    Client:

     
    var RivuletClient = require('rivulet_client');
     
    var client = new RivuletClient('/rivulets/boom');
     
    client.on('data', function(person) {
      console.log('My name is ' + person.name);
    });
     
    client.on('private', function(person) {
      console.log(person.name + " sent you a private message");
    });
     
    client.on('connect', function() {
      console.log('You have connected');
    });
     

    Notes

    Client will automatically reconnect on a disconnection. To fully disconnect use the client's disconnect method directly.

    Caveat

    If you are using this library outside the client, you must pass the full path i.e. http://localhost:3000/rivulets/boom.

    Keywords

    none

    install

    npm i rivulet_client

    Downloadsweekly downloads

    4

    version

    0.0.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar