Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 377
Alexander Gorg Avatar asked Feb 21 '17 10:02

Alexander Gorg


People also ask

What is an action cable?

1 What is Action Cable? 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.

What is Web socket in Rails?

WebSocket is a protocol that allows bi-directional web communication between client and server, and Action Cable is the native Rails integration of this protocol. You can configure your application to communicate via Action Cable using the method below.


1 Answers

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.

like image 148
rogelio Avatar answered Sep 28 '22 16:09

rogelio