Home » Nodejs » What is the Ruby equivalent of Node.js' socket.io?

What is the Ruby equivalent of Node.js' socket.io?

Posted by: admin November 30, 2017 Leave a comment


If I wanted to translate my node application that uses socket.io into a Ruby on Rails application what are the options for replacing socket.io? (Essentially looking for a socket server for Ruby)


Plan to translate the application below:


I’d recommend the Faye Ruby implementation as a solid server-side realtime component. It’s not a direct port of socket.io but provides you with the realtime infrastructure and some well define messaging concepts that will help you port most realtime applications.

You can find more options via the realtime web tech guide.


I highly recommend Pubnub, it has many wrappers including ruby.

Documentation is really easy to follow and they have many tutorials.

I have used Pubnub on many rails projects, including raspberry pie projects.

Rails 5 now has ActionCable built in, which means websockets are now standard with Rails!


Did you look at the Plezi framework?

You can use it either as a separate framework or to augment Rails/Sinatra by adding websocket functionality.

It runs using the Iodine server and supports native websockets, RESTful routes and HTTP streaming, so it’s easy to have a fallback position such as long-pulling, much like socket.io does when web sockets don’t work.

It’s interesting and easy to develop with and has native support for Redis, so it allows websocket broadcasts between processes and machines… although it’s still under development, it’s full of potential.

A broadcast/echo WebSocket app can look like this:

require 'plezi'

class Echo

  def index
    "this is an echo server - use websockets to connect. test with: https://www.websocket.org/echo.html"

  def on_message data
    _echo data
    broadcast :_echo, data

  def _echo data
    response << data

Plezi.route '/', Echo

You can actually put the code in the irb console and the server will start the moment you exit irb using the exit command.