The hello world of websocket apps is the chat. This one actually creates little chat rooms you can squat in.
Built on Rails 5.rc1 using ActionCable. ActionCable was pleasant to work with, and fit into the Rails development flow pretty well. I’m developing my thoughts on what I think it may mean for Rails architectures in the future. But so far, I can recommend!
I haven’t had time to experiment with this yet. Do you have details on how it works? Does it poll requests, or maybe something more down to the metal TCP-ish?
It uses websockets and rack’s “socket hijacking” feature. It then presents the concept of a channel, which allows you to broadcast messages bi-directionally between the server and the clients.
Threads are handled inside ActionCable, so it can be run from any ruby server (Puma, Unicorn, etc), as long as that server can support socket hijacking (so not WEBrick).
EDIT: Oh yeah, I meant to include this link about socket hijacking → Hijack by raggi · Pull Request #481 · rack/rack · GitHub