3 ms·
I love Rails. And in 2014 I wanted to build a very specific type of realtime app with Rails. I used Faye-websocket and Redis and got everything working with Pu
by bphogan 11y ago
I love Rails. And in 2014 I wanted to build a very specific type of realtime app with Rails. I used Faye-websocket and Redis and got everything working with Puma.... and it fell flat on its face.
I learned enough Elixir and Phoenix to be dangerous and built the same thing there in about 2 days with much, much better performance. I've been working on it since.
I don't see myself moving away from Rails for most things I write because it's just more mature and suits my style of coding. I disagree with the way the developers of Ecto (the database adapter for Phoenix) are approaching things, so if I have a web to database app, it's Rails all the way. (Their decisions aren't bad. I just don't like them and that's my problem, not theirs.)
But if I have to do anything that deals with the realtime web, I can't think of anything better than Phoenix. I'll get over my issues with the DB layer and get stuff done because Phoenix channels are awesomel
This is a long winded way of saying "you should really look into Phoenix." :)
- padseeker 11y agoI haven't even had the chance to learn Node and Meteor. The list of stuff I want to learn grows by the week. So many things to learn. Too many things! Phoenix will have to wait.
- nickjj 11y agoI have a Rails app running in production now where I used Faye for the websocket component. Faye is running in an isolated process (the nodejs version actually), and the Rails app POSTs to it through a Sidekiq worker. Interestingly enough, that's not too dissimilar to the ActionCable model despite using slightly different techs. Long story short, I had no issues with this set up and it's been running for around a year. I'm not at roflcopter scale, but it churns out about 100k events per month through Rails->Sidekiq->Faye without breaking a sweat.
- bphogan 11y agoThat sounds really complicated to me. Lots of moving parts to maintain. What is Sidekiq doing for you?
- nickjj 11y agoIt's simple to me because Rails doesn't know or care about the websocket server, it just understands that it needs to POST data to an end point with certain data. I can have 1 or 100 Rails instances posting to the single Faye server. The Faye server doesn't know or care about Rails. It just needs to do its job of broadcasting the event to subscribers. Sidekiq is there for me to easily monitor the events processed, and in theory the Rails app may not be in the same private network as the Faye server, so I decided to make the POST requests happen in Sidekiq. It seems like a good spot for that, since it's a "send it and move on with life". The Faye server pretty much runs itself, it's been going for months and months without maintenance. Sidekiq gets updated once in a while because I'm using it for other things too and sometimes the app code for it changes, not a big deal tho.