Ruby API Quick Start

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 client passing it the channel_id and secret_key that you can find from your channel's page from Scaledrone's dashboard.

require 'scaledrone'

sd = ScaleDrone.new({
  channel_id: 'CHANNEL_ID',
  secret_key: 'SECRET_KEY'
})

Sending messages

Rooms are used to isolate different message types. To listen to messages, you need to subscribe to a specific room.
Users can freely connect to multiple rooms (this does not create extra connections).

room = 'notifications'
message = {foo: 'bar'}
response = sd.publish(message, room)