Skip to content

Commit

Permalink
fix(cli): anticipate no connect properties using older MQTT
Browse files Browse the repository at this point in the history
  • Loading branch information
keynslug committed Jun 28, 2024
1 parent 4a901fc commit cec60b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/emqtt_cli.erl
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ main(PubSubOrJustConnect, Opts0) ->
disconnect(Client);
sub ->
subscribe(Client, NOpts),
KeepAlive = maps:get('Server-Keep-Alive', Properties, get_value(keepalive, NOpts)) * 1000,
timer:send_interval(KeepAlive, ping),
KeepAlive = case Properties of
#{'Server-Keep-Alive' := I} -> I;
_ -> get_value(keepalive, NOpts)
end,
timer:send_interval(KeepAlive * 1000, ping),
receive_loop(Client, Print)
end;
{error, Reason} ->
Expand Down

0 comments on commit cec60b0

Please sign in to comment.