NFIBrokerage / slipstream

A slick WebSocket client for Phoenix Channels
https://hex.pm/packages/slipstream
Apache License 2.0
155 stars 18 forks source link

replace :gun with mint_web_socket #35

Closed the-mikedavis closed 3 years ago

the-mikedavis commented 3 years ago

https://github.com/NFIBrokerage/mint_web_socket is getting somewhat mature and it now supports HTTP/2.

Once https://github.com/NFIBrokerage/mint_web_socket/pull/9 and associated mint PRs are merged, it'd be nice to try out replacing :gun with it.

:gun is fine and fun to work with, but it has (as Frank points out here https://github.com/nerves-hub/nerves_hub_link/pull/68#issuecomment-794616197) some very specific hex dependencies that make it hard to use cowboy (usually by proxy of phoenix) and gun in the same project without an override.

This will be a somewhat large refactor of Slipstream.Connection so I think it's best to completely blow away the code for Slipstream.Connection and Slipstream.Connection.Pipeline and rewrite them from scratch. Mostly I want to do this because the paradigm of working with mint (and specifically Mint.WebSocket) is very different from the prescribed-process-architecture approach of gun (because of mint's processless architecture).

It may also be a nice time to bring in https://github.com/elixir-ecto/connection and fashion Slipstream.Connection after Spear.Connection (with the notable difference that Slipstream.Connection is a temporary genserver whose lifecycle is controlled by the user/author).