   def init(args) do
     Process.flag(:sensitive, true)
     jwt = Keyword.fetch!(args, :jwt)
-    {:ok, %State{conn: nil, chan: nil, jwt: jwt}, 1000}
+    http_ping_timer = Process.send_after(self(), :http_ping, 5000)
+
+    state = %State{
+      conn: nil,
+      chan: nil,
+      jwt: jwt,
+      http_ping_timer: http_ping_timer,
+      ping_fails: 0
+    }
+
+    {:ok, state, 1000}
   end
 
   def terminate(reason, state) do

    end
  end

  # Confirmation sent by the broker after registering this process as a consumer
  def handle_info({:basic_consume_ok, _}, state) do
    {:noreply, state}

  use GenServer
  use AMQP

  alias FarmbotExt.{API, AMQP.ConnectionWorker}

  require Logger
  require FarmbotCore.Logger

  @exchange "amq.topic"

  @lower_bound_ms 900_000
  @upper_bound_ms 1_200_000

  defstruct [:conn, :chan, :jwt, :http_ping_timer, :ping_fails]
  alias __MODULE__, as: State

  @doc false
