Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jrschumacher/node-thunderpush
https://github.com/jrschumacher/node-thunderpush
Last synced: about 2 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/jrschumacher/node-thunderpush
- Owner: jrschumacher
- Created: 2014-08-01T23:21:19.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-01T23:23:52.000Z (over 10 years ago)
- Last Synced: 2024-10-09T22:22:27.634Z (about 1 month ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Thunderpush API library for node.js
> Thunderpush API library
## Getting Started
Install the module with: `npm install thunderpush`
``` js
var Thunderpush = require('thunderpush');var thunderpush = new Thunderpush({
host: 'localhost', // default: localhost
port: 1234, // default: 80
key: 'somepublickey',
secret: 'someprivatekey'
});// build connection
var tpHandle = thunderpush.connect();// Get channel users
tpHandle.channel("my-channel").get(); // [123, 456, 789]// Message channel users
tpHandle.channel("my-channel").message("hi"); // 3// Get number of connected users
tpHandle.user().get(); // 12// Get user 123 presence
tpHandle.user(123).presence(); // online || offline// Message user 123
tpHandle.user(123).message("hi"); // 1// Disconnect user 123
tpHandle.user(123).disconnect();
```Install with cli command
``` sh
$ npm install -g thunderpush
$ thunderpush-cli --help
Usage: cli [options] [command]Commands:
ping
Test connectionserver:connections
Get number of connectionsserver:users [options]
Get count of usersserver:channels
Get list of channelschannel:users [options]
Get list of users in a channelchannel:message [message]
Send message to a channeluser:presence
Get user presenceuser:message [message]
Send message to a userOptions:
-h, --help output usage information
-V, --version output the version number
-h, --host Hostname of service
-p, --port Port of service
-k, --key Key for service [required]
-s, --secret-key Secret key for service [required]
-v, --verbose Add verbosityExamples:
$ thunderpush-cli -vvv -k key -s secret ping
DEBUG: Sending ping
DEBUG: Server took 200ms
$
```## Documentation
See source code for documentation.
_(More coming soon)_
## Examples
See the cli script for an example
_(More coming soon)_
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com).
## License
Copyright (c) 2014 Ryan Schumacher
Licensed under the MIT license.