realizehit-client-ws

0.0.4 • Public • Published

realizehit-client-ws Build Status

realizehit WS Client

Usage

Run as NPM module

npm i -g realizehit-client-ws
var WSClient = require( 'realizehit-client-ws' )
var client = new WSClient( 'ws://realizehit.example.com/' )
 
// Publish something cool
client.subscribe({ kind: 'news', channel: 'CNN' })
    .on( 'subscribed', function () {
        console.log( 'yolo!!1' )
    })
    .on( 'payload', function ( payload ) {
        console.log( payload ) // will log payloads from channel:CNN|kind:news
    })
    .on( 'unsubscribed', function () {
        console.log( 'ohno!!1' )
    })
 
// Save subscription instead of chaining
var subscription = client.subscribe({ foo: 'bar' })
 
if ( subscription.subscribing() ) {
    subscription.once( 'subscribed', function () {
        subscription.unsubscribe()
    })
}
 

Run from the command-line (WIP)

Not developed, just an idea, want to develop it?

Contributing

git clone https://github.com/realizehit/client-ws.js.git
cd client-ws.js
npm install
npm test

Dependencies (8)

Dev Dependencies (5)

Package Sidebar

Install

npm i realizehit-client-ws

Weekly Downloads

0

Version

0.0.4

License

GPL-3.0

Last publish

Collaborators

  • cuss