Hotwire by Basecamp

Does that mean both gzipping and unzipping happens in Elixir code instead of nginx or another reverse proxy? Is it implemented in a way that supports all LV supported browsers? It looks like there’s been a bunch of different headers that various browsers expect. With HTTP this is something that nginx would usually handle.

As recent as 2020, it looks like maybe Safari doesn’t support the official spec based on comments in javascript - How does WebSocket compress messages? - Stack Overflow.

That opens a can of worms of needing to drag in both JS libs and have them play nice together. The trade off there are increasing your bundle size and also increasing the complexity. I’ve also seen Chris and others say to LV all the things (in the context of creating an app where it makes sense, like not needing offline support, etc.).

2 Likes

Per the link above, Safari supports x-webkit-deflate-frame. If you search for x-webkit-deflate-frame on Cowboy repository, you will see it explicitly checks for this header, alongside permessage-deflate.

Compression happens within the VM by calling zlib:gzip/1, which is a C binding to zlib, the lib used by most systems and apparently Nginx too. I actually like that compression is handled in Elixir because the data is compressed from beginning to end.

15 Likes

First things first: Happy new year!

Thanks to all participants for the awesome questions and answers to clarify what the differences and similarities of the systems are.

I think, subsuming the thread, that the systems are different enough to justify salvaging some ideas from over there :slight_smile: In the end this is what this thread seems to be about: Someone interested in a "Basecamp Hotwire" library for Phoenix? - #11 by cnck1387 so I won’t recap in here.

Lastly I’d like to take a moment to acknowledge how utterly awesome this community is… I mean really: I just posted a slightly tounge in cheek comment right before heading into the holidays and it ensues the most productive and civil discussion you could imagine - even with deep participation of the creators of the mentioned technology. This is incredible…

Despite all the technical bells and whistles of the platform: the community around Elixir is, for me, by far the biggest asset and best feature of the whole stack. Thank you all so much :heart:


OT

Is there a branch for this? I’d like to help with this if possible, since I have a usecase for this :smiley:

1 Like