Skip to content

Commit

Permalink
Use slipstream ~> 0.8
Browse files Browse the repository at this point in the history
This removes the requirement on `:gun` and `:cowlib` to instead rely on
Slipstreams new `mint_websocket` backend.
  • Loading branch information
jjcarstens committed Oct 1, 2021
1 parent 07ea3c5 commit 677faf7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
15 changes: 7 additions & 8 deletions lib/nerves_hub_link.ex
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
defmodule NervesHubLink do
alias NervesHubLink.Supervisor, as: NHLSupervisor
alias NervesHubLink.{ConsoleChannel, DeviceChannel, Socket}
alias NervesHubLink.Socket

@doc """
Checks if the device is connected to the NervesHub device channel.
"""
@spec connected? :: boolean()
def connected?() do
NervesHubLink.Socket.check_connection(:device)
Socket.check_connection(:device)
end

def console_connected?() do
NervesHubLink.Socket.check_connection(:console)
Socket.check_connection(:console)
end

@doc """
Checks if the device has a socket connection with NervesHub
"""
def socket_connected?() do
NervesHubLink.Socket.check_connection(:socket)
Socket.check_connection(:socket)
end

@doc """
Expand All @@ -31,17 +30,17 @@ defmodule NervesHubLink do
Restart the socket and device channel
"""
@spec reconnect() :: :ok
defdelegate reconnect(), to: NervesHubLink.Socket
defdelegate reconnect(), to: Socket

@doc """
Send update progress percentage for display in web
"""
@spec send_update_progress(non_neg_integer()) :: :ok
defdelegate send_update_progress(progress), to: NervesHubLink.Socket
defdelegate send_update_progress(progress), to: Socket

@doc """
Send an update status to web
"""
@spec send_update_status(String.t() | atom()) :: :ok
defdelegate send_update_status(status), to: NervesHubLink.Socket
defdelegate send_update_status(status), to: Socket
end
2 changes: 1 addition & 1 deletion lib/nerves_hub_link/socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule NervesHubLink.Socket do
@impl Slipstream
def init(config) do
opts = [
gun_open_options: %{transport: :tls, transport_opts: config.ssl},
mint_opts: [protocols: [:http1], transport_opts: config.ssl],
uri: config.socket[:url],
rejoin_after_msec: [@rejoin_after]
]
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule NervesHubLink.MixProject do
use Mix.Project

@version "0.10.0-rc.0"
@version "0.12.1"
@source_url "https://github.com/nerves-hub/nerves_hub_link"

Application.put_env(
Expand Down Expand Up @@ -103,7 +103,7 @@ defmodule NervesHubLink.MixProject do
{:nerves_runtime, "~> 0.8"},
{:nerves_hub_link_common, "~> 0.3.0"},
{:nerves_hub_ca_store, "~> 1.0.0"},
{:slipstream, "~> 0.6.0"},
{:slipstream, "~> 0.8"},
{:x509, "~> 0.5"}
]
end
Expand Down
5 changes: 2 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"castore": {:hex, :castore, "0.1.11", "c0665858e0e1c3e8c27178e73dffea699a5b28eb72239a3b2642d208e8594914", [:mix], [], "hexpm", "91b009ba61973b532b84f7c09ce441cba7aa15cb8b006cf06c6f4bba18220081"},
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"},
"circuits_i2c": {:hex, :circuits_i2c, "0.3.9", "746a599ac06f8d31572143a8c51e1bc787246c173669940dc23e078907fb13e1", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "c6d75387637a4fbae77cf37af45000fe23763eb8104cc50e7aae532bec46e91d"},
"cowlib": {:hex, :cowlib, "2.7.3", "a7ffcd0917e6d50b4d5fb28e9e2085a0ceb3c97dea310505f7460ff5ed764ce9", [:rebar3], [], "hexpm", "1e1a3d176d52daebbecbbcdfd27c27726076567905c2a9d7398c54da9d225761"},
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
"earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"},
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
Expand All @@ -12,7 +11,6 @@
"excoveralls": {:hex, :excoveralls, "0.14.2", "f9f5fd0004d7bbeaa28ea9606251bb643c313c3d60710bad1f5809c845b748f0", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "ca6fd358621cb4d29311b29d4732c4d47dac70e622850979bc54ed9a3e50f3e1"},
"extty": {:hex, :extty, "0.2.1", "4da6d78d41f0a9ff9980d82968476b4277ac0afa227d2ed91af0ffcbac2f451b", [:mix], [], "hexpm", "26b2e495c14501d4ae24c7dffba199f6abf0a0f69dcfd07db62f421952442f05"},
"fwup": {:hex, :fwup, "1.0.0", "6873189185d9bc71f92128a96c6e44218a55a585edeb46551bb838886782de02", [:mix], [], "hexpm", "7338e85fa2b00832e1efd7b564c7b838d791cfedd0f1f7811e23dc678334a755"},
"gun": {:hex, :gun, "1.3.3", "cf8b51beb36c22b9c8df1921e3f2bc4d2b1f68b49ad4fbc64e91875aa14e16b4", [:rebar3], [{:cowlib, "~> 2.7.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "3106ce167f9c9723f849e4fb54ea4a4d814e3996ae243a1c828b256e749041e0"},
"hackney": {:hex, :hackney, "1.18.0", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
Expand All @@ -23,6 +21,7 @@
"mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"mint": {:hex, :mint, "1.4.0", "cd7d2451b201fc8e4a8fd86257fb3878d9e3752899eb67b0c5b25b180bde1212", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "10a99e144b815cbf8522dccbc8199d15802440fc7a64d67b6853adb6fa170217"},
"mint_web_socket": {:hex, :mint_web_socket, "0.1.4", "f83f7f0abbfacbb6f20017564c3469b3686c772615f7d5030a967ec946e0a6e3", [:mix], [{:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: false]}], "hexpm", "b314953c2370087d4fb4d7d472978a166db83def89f9b21458b0ce48ceada7f0"},
"mox": {:hex, :mox, "1.0.0", "4b3c7005173f47ff30641ba044eb0fe67287743eec9bd9545e37f3002b0a9f8b", [:mix], [], "hexpm", "201b0a20b7abdaaab083e9cf97884950f8a30a1350a1da403b3145e213c6f4df"},
"nerves_hub_ca_store": {:hex, :nerves_hub_ca_store, "1.0.0", "d8681e8f08d2d1b8a43184a5e8370066f62b949a4bcf19cde880a0dbe45bb1f4", [:mix], [{:x509, "~> 0.5", [hex: :x509, repo: "hexpm", optional: false]}], "hexpm", "01fbf3edc64be5bf8f3fc65f7f8ca6b82dab650af4373e201b6d441ded476c84"},
"nerves_hub_cli": {:hex, :nerves_hub_cli, "0.11.1", "1cc81be823875aa3bd77b6eefba29ab65767735823f56bb256bfe3843dc75e9d", [:mix], [{:nerves_hub_user_api, "~> 0.8.0", [hex: :nerves_hub_user_api, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 0.7 or ~> 1.1", [hex: :nimble_csv, repo: "hexpm", optional: false]}, {:pbcs, "~> 0.1", [hex: :pbcs, repo: "hexpm", optional: false]}, {:table_rex, "~> 2.0.0 or ~> 3.0", [hex: :table_rex, repo: "hexpm", optional: false]}, {:x509, "~> 0.3", [hex: :x509, repo: "hexpm", optional: false]}], "hexpm", "7a7d005b5d087fb40e7e84fc543a8b120d738210d3d115045cea415e02c7ec9d"},
Expand All @@ -36,7 +35,7 @@
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"},
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
"pbcs": {:hex, :pbcs, "0.1.4", "84c64d6ec826a57821021c03b0db3598ee587ba64430badee77809c2f68a9f8c", [:mix], [], "hexpm", "1f96954e50077e9cfde3cce62da452f4e56906d019ef141c011a96f79137dec0"},
"slipstream": {:hex, :slipstream, "0.6.2", "e491edbf2d76413cbffd4bd69dafa963ef48aac865f2808232bb449265f84a1c", [:mix], [{:gun, "~> 1.0", [hex: :gun, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_options, "~> 0.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1df8f7e9bc626171e7eac6573959cb059c8130875ab73d3256399b81bd9809f4"},
"slipstream": {:hex, :slipstream, "0.8.1", "3b2484e7d354c861eb4cd76a4685e309925fb99e722b318aa4c4bac8ba0a8a2e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mint_web_socket, "~> 0.1", [hex: :mint_web_socket, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9580a685e85677316fe0688f16bb9eccdc921023b60ee2bcf98794ff4513da1b"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"system_registry": {:hex, :system_registry, "0.8.2", "df791dc276652fcfb53be4dab823e05f8269b96ac57c26f86a67838dbc0eefe7", [:mix], [], "hexpm", "f7acdede22c73ab0b3735eead7f2095efb2a7a6198366564205274db2ca2a8f8"},
"table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"},
Expand Down

0 comments on commit 677faf7

Please sign in to comment.