nerves-hub / nerves_hub_link

Connect devices to NervesHub via a Phoenix channel
https://hex.pm/packages/nerves_hub_link
Apache License 2.0
36 stars 18 forks source link

Use Slipstream as WS client #68

Closed jjcarstens closed 3 years ago

jjcarstens commented 3 years ago

Changes to use Slipstream as the WS client to handle connections with NervesHub web. The intent will be to deprecate phoenix_client in favor of this implementation.

So far this is working well. Its been released as 0.10.0-rc.0 so others can test as well

fhunleth commented 3 years ago

To keep everyone in the loop, the gun dependency is currently a nonstarter. gun has very specific version dependencies on cowlib. Unfortunately, cowboy also has very specific and different version dependencies on cowlib. Therefore you can't have gun and cowboy in the same project. This would break every Nerves project that's using Phoenix right now.

I've been looking around for suggestions on alternative websocket libraries or if anyone is interested in working with Loic and whomever maintains his libraries on hex to resolve this, that would be most appreciated.

the-mikedavis commented 3 years ago

:wave: @jjcarstens, @fhunleth

Slipstream is changing its low-level WebSocket client from :gun to Mint.WebSocket (see https://github.com/NFIBrokerage/slipstream/pull/38) in version 0.8.0. We have it on an rc tag and we're taking it for a spin in production but it should get merged pretty soon. It looks like this project already has Mint in the dependencies so it should hopefully take only a minimal effort to update.

The only thing I see in this PR that has changed in Slipstream over the last couple versions is that :gun_open_options is now :mint_opts (which get passed to Mint.HTTP.connect/4) and you should be able to configure the TLS certs there.

I'll let y'all know when v0.8.0 gets published!

fhunleth commented 3 years ago

@the-mikedavis This is great news! Thanks for the update!

the-mikedavis commented 3 years ago

Happy friday: v0.8.0 is out!

We finished upgrading slipstream in all of our services and it seems to be going well so far. Hopefully the Mint.WebSocket change works out well for y'all as well :slightly_smiling_face:

jjcarstens commented 3 years ago

Yay!!! I'm so excited for this!

I hope to find time soon to try this out and get slipstream working here!

❤️ 💜 💕 🎉

jjcarstens commented 3 years ago