Merge pull request #6922 from blockscout/fix-websocket-client

Fix WebSocketClient
pull/6932/head
Victor Baranov 2 years ago committed by GitHub
commit db000206c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      apps/block_scout_web/mix.exs
  3. 8
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/web_socket/web_socket_client.ex
  4. 2
      apps/ethereum_jsonrpc/mix.exs
  5. 2
      mix.lock

@ -16,6 +16,7 @@
- [#6891](https://github.com/blockscout/blockscout/pull/6891) - Fix read contract for geth - [#6891](https://github.com/blockscout/blockscout/pull/6891) - Fix read contract for geth
- [#6889](https://github.com/blockscout/blockscout/pull/6889) - Fix Internal Server Error on tx input decoding - [#6889](https://github.com/blockscout/blockscout/pull/6889) - Fix Internal Server Error on tx input decoding
- [#6893](https://github.com/blockscout/blockscout/pull/6893) - Fix token type definition for multiple interface tokens - [#6893](https://github.com/blockscout/blockscout/pull/6893) - Fix token type definition for multiple interface tokens
- [#6922](https://github.com/blockscout/blockscout/pull/6922) - Fix WebSocketClient
### Chore ### Chore

@ -127,7 +127,7 @@ defmodule BlockScoutWeb.Mixfile do
{:timex, "~> 3.7.1"}, {:timex, "~> 3.7.1"},
{:wallaby, "~> 0.30", only: :test, runtime: false}, {:wallaby, "~> 0.30", only: :test, runtime: false},
# `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility # `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility
{:websocket_client, "~> 1.3"}, {:websocket_client, git: "https://github.com/blockscout/websocket_client.git", branch: "master", override: true},
{:wobserver, "~> 0.2.0", github: "poanetwork/wobserver", branch: "support-https"}, {:wobserver, "~> 0.2.0", github: "poanetwork/wobserver", branch: "support-https"},
{:ex_json_schema, "~> 0.9.1"}, {:ex_json_schema, "~> 0.9.1"},
{:ueberauth, "~> 0.7"}, {:ueberauth, "~> 0.7"},

@ -104,20 +104,20 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do
@impl WebSocket @impl WebSocket
@spec json_rpc(WebSocket.web_socket(), Transport.request()) :: {:ok, Transport.result()} | {:error, reason :: term()} @spec json_rpc(WebSocket.web_socket(), Transport.request()) :: {:ok, Transport.result()} | {:error, reason :: term()}
def json_rpc(web_socket, request) do def json_rpc(web_socket, request) do
GenServer.call(web_socket, {:json_rpc, request}) GenServer.call(web_socket, {:gen_call, {:json_rpc, request}})
end end
@impl WebSocket @impl WebSocket
@spec subscribe(WebSocket.web_socket(), Subscription.event(), Subscription.params()) :: @spec subscribe(WebSocket.web_socket(), Subscription.event(), Subscription.params()) ::
{:ok, Subscription.t()} | {:error, reason :: term()} {:ok, Subscription.t()} | {:error, reason :: term()}
def subscribe(web_socket, event, params) when is_binary(event) and is_list(params) do def subscribe(web_socket, event, params) when is_binary(event) and is_list(params) do
GenServer.call(web_socket, {:subscribe, event, params}) GenServer.call(web_socket, {:gen_call, {:subscribe, event, params}})
end end
@impl WebSocket @impl WebSocket
@spec unsubscribe(WebSocket.web_socket(), Subscription.t()) :: :ok | {:error, :not_found} @spec unsubscribe(WebSocket.web_socket(), Subscription.t()) :: :ok | {:error, :not_found}
def unsubscribe(web_socket, %Subscription{} = subscription) do def unsubscribe(web_socket, %Subscription{} = subscription) do
GenServer.call(web_socket, {:unsubscribe, subscription}) GenServer.call(web_socket, {:gen_call, {:unsubscribe, subscription}})
end end
@impl :websocket_client @impl :websocket_client
@ -158,7 +158,7 @@ defmodule EthereumJSONRPC.WebSocket.WebSocketClient do
end end
@impl :websocket_client @impl :websocket_client
def websocket_info({:"$gen_call", from, request}, _, %__MODULE__{} = state) do def websocket_info({{:gen_call, request}, from}, _, %__MODULE__{} = state) do
case handle_call(request, from, state) do case handle_call(request, from, state) do
{:reply, _, %__MODULE__{}} = reply -> reply {:reply, _, %__MODULE__{}} = reply -> reply
{:noreply, %__MODULE__{} = new_state} -> {:ok, new_state} {:noreply, %__MODULE__{} = new_state} -> {:ok, new_state}

@ -81,7 +81,7 @@ defmodule EthereumJsonrpc.MixProject do
# `:verify_fun` for `Socket.Web.connect` # `:verify_fun` for `Socket.Web.connect`
{:ssl_verify_fun, "~> 1.1"}, {:ssl_verify_fun, "~> 1.1"},
# `EthereumJSONRPC.WebSocket` # `EthereumJSONRPC.WebSocket`
{:websocket_client, "~> 1.3"}, {:websocket_client, git: "https://github.com/blockscout/websocket_client.git", branch: "master", override: true},
{:decimal, "~> 2.0"}, {:decimal, "~> 2.0"},
{:decorator, "~> 1.4"}, {:decorator, "~> 1.4"},
{:hackney, "~> 1.18"}, {:hackney, "~> 1.18"},

@ -137,6 +137,6 @@
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"wallaby": {:hex, :wallaby, "0.30.1", "81342a34080867ab359aca23de4d1d8c6bbdeb35d8ce2a8c42e42b758d539963", [:mix], [{:ecto_sql, ">= 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}, {:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_ecto, ">= 3.0.0", [hex: :phoenix_ecto, repo: "hexpm", optional: true]}, {:web_driver_client, "~> 0.2.0", [hex: :web_driver_client, repo: "hexpm", optional: false]}], "hexpm", "457251df6a94ff80816524136edbce6400cb1ee979586c90224ff634e9543d78"}, "wallaby": {:hex, :wallaby, "0.30.1", "81342a34080867ab359aca23de4d1d8c6bbdeb35d8ce2a8c42e42b758d539963", [:mix], [{:ecto_sql, ">= 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}, {:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_ecto, ">= 3.0.0", [hex: :phoenix_ecto, repo: "hexpm", optional: true]}, {:web_driver_client, "~> 0.2.0", [hex: :web_driver_client, repo: "hexpm", optional: false]}], "hexpm", "457251df6a94ff80816524136edbce6400cb1ee979586c90224ff634e9543d78"},
"web_driver_client": {:hex, :web_driver_client, "0.2.0", "63b76cd9eb3b0716ec5467a0f8bead73d3d9612e63f7560d21357f03ad86e31a", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:tesla, "~> 1.3", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "83cc6092bc3e74926d1c8455f0ce927d5d1d36707b74d9a65e38c084aab0350f"}, "web_driver_client": {:hex, :web_driver_client, "0.2.0", "63b76cd9eb3b0716ec5467a0f8bead73d3d9612e63f7560d21357f03ad86e31a", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:tesla, "~> 1.3", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "83cc6092bc3e74926d1c8455f0ce927d5d1d36707b74d9a65e38c084aab0350f"},
"websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm", "b864fa076f059b615da4ab99240e515b26132ce4d2d0f9df5d7f22f01fa04b65"}, "websocket_client": {:git, "https://github.com/blockscout/websocket_client.git", "0b4ecc5b1fb8a0bd1c8352728da787c20add53aa", [branch: "master"]},
"wobserver": {:git, "https://github.com/poanetwork/wobserver.git", "13bcda30a87f4f0be1878920a79433ad831eefbe", [branch: "support-https"]}, "wobserver": {:git, "https://github.com/poanetwork/wobserver.git", "13bcda30a87f4f0be1878920a79433ad831eefbe", [branch: "support-https"]},
} }

Loading…
Cancel
Save