fix(elixir): make elixir tcp client heartbeats work the same way as rust client
Ideally we'd want to enable TCP keepalive on both, but that's how it's currently
implemented on Rust, so making it identical.
@@ -87,10 +87,16 @@ defmodule Ockam.Transport.TCP.Client do
{:stop, :normal, state}
end
- def handle_info(:heartbeat, %{socket: socket} = state) do
+ def handle_info(:heartbeat, state) do
case heartbeat_enabled?(state) do
true ->
- :gen_tcp.send(socket, "")
+ empty_message = %Message{
+ onward_route: [state.address],
+ return_route: [],
+ payload: ""
+ }
+
+ encode_and_send_over_tcp(empty_message, state)
schedule_heartbeat(state)
false ->
