8

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

Alexander Gorg
  • 1,049
  • 16
  • 32
  • 2
    It is easier to vote down than answer, right? – Alexander Gorg Feb 21 '17 at 14:55
  • 1
    I think the down votes was because the question is a little bit [off-topic](http://stackoverflow.com/help/on-topic) – rogelio Feb 21 '17 at 16:00
  • 4
    I think that's because people love questions like "What's the command for running a migration?" My question wasn't off-topic, however, it looked like at glance. At least I didn't want to be off-topic. I just wanted to get what's the difference _in further programming_ before integrating any of these gems. – Alexander Gorg Feb 21 '17 at 20:27
  • 2
    Why it is off-topic?? – Felipe Maion Feb 28 '17 at 04:30
  • 2
    @FelipeMaion People think I asked: "Which gem is better?". Nevertheless, it is a question about the difference between these gems. – Alexander Gorg Feb 28 '17 at 14:35

1 Answers1

10

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.

rogelio
  • 1,541
  • 15
  • 19
  • Future readers might want to know that ActionCable performs TERRIBLY. I ran into my own problems with it only after moving my work to a production environment, and it's literally so bad that it's unusable if you expect high traffic. As example, this post here describes a benchmark test involving 20,000 idle clients. ActionCable uses 3.5GB of memory, compared to other solutions, which are < 900MB https://medium.com/@leshchuk/from-action-to-any-1e8d863dd4cf – calyxofheld Jan 13 '20 at 03:19