Any Cables Monthly

Share this post

Any Cables Monthly #8

anycable.substack.com

Discover more from Any Cables Monthly

AnyCable and more: a monthly digest from the world of building real-time and collaborative user experience for web and mobile. By Vladimir Dementyev and Evil Martians.
Continue reading
Sign in

Any Cables Monthly #8

March, 2023

Apr 7, 2023
1
Share this post

Any Cables Monthly #8

anycable.substack.com
Share

🌸 Welcome to the first spring issue of our newsletter, teeming with fresh insights on AnyCable, Hanami, and serverless WebSockets. Dive in and let your curiosity bloom!

(P.S. This intro was crafted by yours truly, GPT-4 🤖)


Highlights

AnyCable off Rails: connecting Twilio streams with Hanami

This article covers a lot of things: consuming Twilio Media streams with AnyCable, enhancing Hanami with Phlex, Vite, and CableReady. Don’t be overwhelmed, read responsibly 🙂


Videos

Flying multi-regionally with NATS


Releases

AnyCasts Demo

The demo application used in AnyCasts goes public. Check out the code of the past and future episodes!

litecable · 0.8.0

The release makes it possible to provide custom channel resolution logic (we use it in the AnyCable Hanami example mentioned above).

xk6-cable · 0.6.0

The xk6-cable repository now also hosts JS helpers to simplify writing scenarios for Action Cable / AnyCable applications.


The frame of curiosity: serverless WebSockets

Twitter avatar for @metaskills
Ken Collins @metaskills
Lot of work to do on this, but seems that #Serverless #WebSockets & with #RubyOnRails is going to be a thing. Needs some ActionCable testing, along with a working example. Thinking I might take the @any_cable demo app here and throw it on Lambda? github.com/anycable/anyca…
Image
2:51 AM ∙ Mar 9, 2023
10Likes1Retweet

Wait, what? Serverless WebSockets? Is that a thing? Yes, it is.

Serverless functions have been around for enough time to become mundane. The concept (for end users) is pretty simple: you write a function, upload it and trigger it via HTTP API or some internal platform-specific mechanism. Every execution is independent and isolated, just like a standalone process. (Just like a good old CGI but at the cloud level).

WebSockets are different. They’re long-lived; they’re stateful. We can not process WebSocket connections with regular serverless functions. First, serverless functions usually have execution time limits too small to serve persistent connections. Secondly, WebSocket connections are typically idle for most of their lifetime—it’s a waste of precious (and pricey) serverless resources.

To overcome these limitations, serverless platforms provide a separate layer to handle connections and only delegate events to serverless functions. Doesn’t it sound familiar? It’s the same principle that AnyCable uses to offload WebSockets. Technically, AnyCable-Go plays the same role as AWS API Gateway, for example.

Routing WebSocket events to serverless functions works great. The most complicated part of serverless WebSockets is broadcasting messages to connected clients. In other words, the pub/sub component must be implemented from scratch*.

It’s questionable whether such architecture scales despite being serverless. Probably, a mix of serverful and serverless would be a better option here.

Still, I’m very excited by the ongoing research on serverless WebSockets in the Ruby community. Check out this issue in the Lamby repository for more resources on the topic.


* AWS AppSync can be integrated with another AWS product, EventsBridge, to build a pub/sub layer, but it’s bound to GraphQL protocol.

1
Share this post

Any Cables Monthly #8

anycable.substack.com
Share
Previous
Next
Comments
Top
New

No posts

Ready for more?

© 2023 AnyCable
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing