ruby-on-railswebsocketfayeactioncable

Is Action Cable the same thing as Faye?


Implementing Web Sockets in my app I've become confused which gem is better. I found plenty of different opportunities, however, some are hard to distinct.

Finally, I've chosen Action Cable (a Rails 5 native part) and Faye (appeared earlier and became very popular).

But now I'm stuck - is Action Cable the same thing as Faye? Which are differences (if there's any)?


Solution

  • From the Faye website: Faye is a publish-subscribe messaging system based on the Bayeux protocol. It provides message servers for Node.js and Ruby, and clients for use on the server and in all major web browsers.

    From the ActionCable readme: Action Cable seamlessly integrates WebSockets with the rest of your Rails application. It allows for real-time features to be written in Ruby in the same style and form as the rest of your Rails application, while still being performant and scalable. It's a full-stack offering that provides both a client-side JavaScript framework and a server-side Ruby framework. You have access to your full domain model written with Active Record or your ORM of choice.


    Short answer is YES, both are pub/sub messaging system.

    Long answer is NO, because faye is a low-level tool and ActionCable uses faye (look here), al least some components.

    But you always can get the same results using (maybe) different efforts building an application using faye or ActionCable. The big difference is Faye works as a rack-based component instead of rails-based component.