https://github.com/scaledrone/scaledrone-ruby
Ruby library for Scaledrone Realtime Messaging Service
https://github.com/scaledrone/scaledrone-ruby
real-time ruby scaledrone
Last synced: 6 months ago
JSON representation
Ruby library for Scaledrone Realtime Messaging Service
- Host: GitHub
- URL: https://github.com/scaledrone/scaledrone-ruby
- Owner: ScaleDrone
- Created: 2015-10-31T17:21:19.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-29T06:29:13.000Z (about 9 years ago)
- Last Synced: 2025-03-20T11:32:54.058Z (9 months ago)
- Topics: real-time, ruby, scaledrone
- Language: Ruby
- Homepage: https://www.scaledrone.com
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scaledrone Ruby API
Official ScaleDrone Ruby pushing library. This is a wrapper around the REST API.
## Installation
Add this line to your application's Gemfile:
```
gem 'scaledrone'
```
And then execute:
```
bundle install
```
Or install it directly:
```
gem install 'scaledrone'
```
## Usage
Create a new instance of ScaleDrone passing it the `channelId` and `secretKey` that you can find from the channel's page
```ruby
require 'scaledrone'
sd = ScaleDrone.new({
channel_id: 'G3TYvCzoXtrIuEtQ',
secret_key: 'M7Oc1DY2FgkCaUh4aQFC3TRV1R3RThPd'
})
```
### Publishing a message
**Please notice that in 1.0.0 the function header changed, when upgrading from 0.X.X you need to switch message and room order.**
```ruby
room = 'notifications'
message = {foo: 'bar'}
response = sd.publish(message, room)
```
### Publishing the same message to multiple rooms
```ruby
rooms = ['notifications', 'lounge']
message = {foo: 'bar'}
response = sd.publish(message, *rooms)
```
### Channel stats
```ruby
response = sd.channel_stats()
```
### Connected users list
```javascript
response = sd.users_list()
```