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.WebSocket #38

Closed the-mikedavis closed 3 years ago

the-mikedavis commented 3 years ago

Not too long ago I started writing Mint.WebSocket as a bit of a pet project after having a great time using Mint to write Spear. It's matured quite a bit, now passing the entire Autobahn|Testsuite and having comparable performance to gun.

Gun is great, but it doesn't play well with other dependencies because of its very specific requirements on the cowlib hex package. In order to use gun in a Phoenix project (which is based on cowboy, which also has very specific dependencies on cowlib), one typically needs to use an override which is pretty bad user experience for consumers.

This PR switches out :gun for Mint.WebSocket as the driving low-level websocket client. I tried to minimize changes to the inner workings of the library. Clients written with Slipstream v0.7 and below should largely be able to upgrade without any changes, but there are some error cases that have changed in what they return as a result of switching WebSocket adapters.

closes #35