This commit is contained in:
anlicheng 2025-04-21 16:34:54 +08:00
parent d4419aa36a
commit 261477ba86
3 changed files with 10 additions and 3 deletions

View File

@ -37,7 +37,7 @@ start_tcp_server() ->
binary,
{reuseaddr, true},
{active, false},
{packet, 2},
{packet, 4},
{nodelay, false},
{backlog, Backlog}
]},

View File

@ -27,7 +27,7 @@ start_link() ->
%% modules => modules()} % optional
init([]) ->
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
Specs = [
Specs0 = [
#{
id => 'iot_device_sup',
start => {'iot_device_sup', start_link, []},
@ -47,7 +47,7 @@ init([]) ->
}
],
{ok, {SupFlags, pools() ++ Specs}}.
{ok, {SupFlags, pools() ++ []}}.
%% internal functions

View File

@ -157,6 +157,13 @@ handle_info({binary, <<?PACKET_PUBLISH_RESPONSE, PacketId:32, Body/binary>>}, St
{ok, State#state{inflight = NInflight}}
end;
handle_info({tcp, Socket, Data}, State = #state{transport = Transport, socket = Socket}) ->
lager:debug("[ws_channel] socket: ~p, get a message: ~p", [Socket, Data]),
Transport:send(Socket, <<"hello world reply">>),
{noreply, State};
handle_info(Info, State) ->
lager:error("[ws_channel] get a unknown message: ~p, channel will closed", [Info]),
{stop, State};