Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/realizehit/client-ws.js
realizehit websocket client for Javascript
https://github.com/realizehit/client-ws.js
Last synced: 16 days ago
JSON representation
realizehit websocket client for Javascript
- Host: GitHub
- URL: https://github.com/realizehit/client-ws.js
- Owner: realizehit
- License: gpl-3.0
- Created: 2015-05-20T12:09:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-26T19:00:39.000Z (almost 9 years ago)
- Last Synced: 2024-04-24T23:01:46.973Z (8 months ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# realizehit-client-ws [![Build Status](https://travis-ci.org/realizehit/client-ws.js.svg?branch=master)](https://travis-ci.org/realizehit/client-ws.js)
realizehit WS Client
## Usage
#### Run as NPM module
```bash
npm i -g realizehit-client-ws
``````javascript
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
```bash
git clone https://github.com/realizehit/client-ws.js.git
cd client-ws.js
npm install
npm test
```