This fall, we expect a lot of great content from the Ruby conferences around the world: RubyKaigi, RailsSaaS, EuRuKo, RubyConf-s (two this year!) However, videos are yet to come (though you can read some textual reports), so let’s enjoy the weather (and a handful of links below) 🍁🍁🍁
Highlights
WebSocket Director: scenario-based integration tests for realtime apps
WebSocket Director (wsdirector) is a testing automation tool for WebSocket servers that uses human-readable scenarios stored in YAML or JSON files. The post demonstrates some use cases and announces the v1.0 release of the tool.
Hacktoberfest is a excellent opportunity to start contributing to open source, don’t miss it!
P.S. All AnyCable projects are marked with “#hacktoberfest” tag. You can find all the issues here (and we’ll be adding more good first issues for Hacktoberfest).
P.P.S. Our friends from GitMerch allows you to create personalized Git-themed T-shirts. Use promo code “ANYCABLE” to get 25% off.
News
Articles
We prepared official documentation on deploying AnyCable apps to Fly.io. Check it out even if you don’t use AnyCable, but another on-premise real-time solution—you can learn some useful tips 😉
Releases
Yabeda is an instrumentation framework for Ruby and Rails apps. The AnyCable plugin got a new patch release with some fixes—nothing fancy, but we still want to mention it to remind you of this project. Check out the blog post to see how Yabeda can help you to enhance the observability of your AnyCable Rails project.
The final 7.2.0 is out. We already mentioned one of the earlier betas in the first issue. This time, we’d like to highlight the ability to respond to GET requests with Turbo Streams.
Frame of curiosity: one tab to rule them all
WebSockets (or any other persistent connections) do not come for free: handling each connection requires allocating some server-side resources. Moreover, the “price” could go up quickly if users tend to open multiple browser tabs with your application (and keep them open forever). So is there a way to reduce the “costs”?
First, we can rely on visibility and lifecycle APIs to detect inactive (or “frozen”) pages (see, for example, anycable-client). Or we can try to share a single connection across tabs. There are multiple options to that.
The preferred way (from the compatibility perspective) is to use a Shared Worker. The cable-shared-worker library works this way. Check it out!
An older (but still working) solution is to use localStorage as a message bus and elect a leader tab to create the actual connection. For example, Logux (another real-time project by Evil Martians) uses this approach.
Finally, the futuristic way combines the yet experimental Web Locks API with the Broadcast Channel API. We plan to build a shared WebSocket transport for anycable-client on top of these technologies. Stay tuned!