realizehit WS Client
npm i -g realizehit-client-ws
var WSClient = require( 'realizehit-client-ws' )
var client = new WSClient( 'ws:https://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()
})
}
Not developed, just an idea, want to develop it?
git clone https://github.com/realizehit/client-ws.js.git
cd client-ws.js
npm install
npm test