Skip to content
This repository was archived by the owner on Nov 5, 2026. It is now read-only.
ablyPublic archive

About

Ruby REST client library SDK for Ably realtime messaging service

Resources

Contributing

Stars

7 stars

Watchers

21 watching

Forks

Repository files navigation

Warning

This SDK has been deprecated. Please use the ably-pubsub-server gem from the ably/ably-pubsub-ruby repository instead.

Ably Chat Header Gem Version License


Ably Pub/Sub Ruby REST SDK

Build using Ably’s Pub/Sub Ruby REST SDK, supported on all popular platforms and frameworks.

Ably Pub/Sub provides flexible APIs that deliver features such as pub-sub messaging, message history, presence, and push notifications. Utilizing Ably’s realtime messaging platform, applications benefit from its highly performant, reliable, and scalable infrastructure.

This REST-only SDK supports applications that do not to include EventMachine as a dependency. It's suitable for Rails or Sinatra applications, that favor the REST library due to its minimal dependencies and synchronous API.

For applications requiring Realtime functionality with an asynchronous, event-driven API, we recommend using the combined REST & Realtime gem.

Find out more:


Getting started

Everything you need to get started with Ably:


Supported platforms

Ably aims to support a wide range of platforms and browsers. If you experience any compatibility issues, open an issue in the repository or contact Ably support.

Platform Support
Ruby >= 2.7

Important

SDK versions < 1.2.5 will be deprecated from November 1, 2025.


Installation

The client library is available as a gem from RubyGems.org.

Add this line to your application's Gemfile:

gem 'ably-rest'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ably-rest

Usage

The following code connects to Ably's REST messaging service, publishes a messages to channel, retrieve message history, generate authentication tokens, and sends end-to-end encrypted messages:

# Initialize client and channel
client = Ably::Rest.new(key: 'your-ably-api-key')
channel = client.channel('test-channel')

# Publishing a message to a channel
channel.publish('test-event', 'hello world!') #=> true

# Querying the History
messages_page = channel.history #=> #<Ably::Models::PaginatedResult ...>
messages_page.items.first.data # payload for the message

# Generate a Token (for secure client connections)
token_details = client.auth.request_token
token_details.token # => "your-token"
client = Ably::Rest.new(token: token_details)

# Encrypted messages
secret_key = Ably::