Skip to content

Commit

Permalink
Previous fix works but trying keepalive instead
Browse files Browse the repository at this point in the history
  • Loading branch information
caike committed Jan 24, 2024
1 parent ba21c6b commit bb08ab8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/xogmios/chain_sync.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ defmodule Xogmios.ChainSync do
@callback handle_block(map(), any()) ::
{:ok, :next_block, map()} | {:ok, map()} | {:ok, :close, map()}

@keepalive_in_ms 5_000

def start_link(client, opts) do
{url, opts} = Keyword.pop(opts, :url)
initial_state = Keyword.merge(opts, handler: client)
:websocket_client.start_link(url, client, initial_state)
:websocket_client.start_link(url, client, initial_state, keepalive: @keepalive_in_ms)
end

defmacro __using__(_opts) do
Expand Down
2 changes: 1 addition & 1 deletion lib/xogmios/chain_sync/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ defmodule Xogmios.ChainSync.Connection do

@impl true
def ondisconnect(_reason, state) do
{:reconnect, 5_000, state}
{:ok, state}
end

@impl true
Expand Down

0 comments on commit bb08ab8

Please sign in to comment.