Slanger - Open Source Pusher protocol powered by Ruby and Redis
Pusher has become a favorite for developers looking to add real-time events to their applications quickly and reliably. For developers who would rather keep everything in-house, Stevie Graham has released Slanger, an open source Ruby implementation of the Pusher protocol that uses Redis on the backend.
Presence channel state is shared using Redis. Channels are lazily instantiated internally within a given Slanger node when the first subscriber connects. When a presence channel is instantiated within a Slanger node, it queries Redis for the global state across all nodes within the system for that channel, and then copies that state internally. Afterwards, when subscribers connect or disconnect the node publishes a presence message to all interested nodes, i.e. all nodes with at least one subscriber interested in the given channel.
With the gem installed, and Redis running, you can fire up Slanger, passing it your Pusher API keys:
$ slanger --app_key 765ec374ae0a69f4ce44 --secret your-pusher-secret
You’ll also need to modify the host and port settings in your server-side Ruby and client-side JavaScript:
# Ruby
...
Pusher.host = 'slanger.example.com'
Pusher.port = 4567
// JavaScript
...
Pusher.host = 'slanger.example.com'
Pusher.ws_port = 8080
The project is brand new, but it looks to be a promising alternative to Pusher if you need to control data end-to-end or just need to run a development environment when your Internet connection is dodgy.
If you’re new to Pusher, websockets, and the real-time web, be sure and check out Episode 0.3.1 for a proper introduction.
Discussion
Sign in or Join to comment or subscribe