version: 0.2.0
+ monitoring wsbus PID
This commit is contained in:
parent
052b0b25c7
commit
c98e8718a8
2 changed files with 4 additions and 1 deletions
|
@ -40,9 +40,12 @@ websocket_info({send, <<Bin/binary>>}, S) ->
|
|||
{[{text, Bin}], S};
|
||||
websocket_info({send, List}, S) when is_list(List) ->
|
||||
{List, S};
|
||||
websocket_info({'DOWN', _, process, PID, _}, #{wsbus := PID} = S) ->
|
||||
{ok, S#{wsbus => nil, ref_wsbus => st:lookup(wsbus)}};
|
||||
websocket_info({_, {Ref, {error, notfound}}}, #{ref_wsbus := Ref} = S) ->
|
||||
{ok, S#{ref_wsbus => st:lookup(wsbus)}};
|
||||
websocket_info({_, {Ref, {ok, PID}}}, #{ref_wsbus := Ref} = S) ->
|
||||
erlang:monitor(process, PID),
|
||||
{ok, maps:remove(ref_wsbus, S#{wsbus => PID})};
|
||||
websocket_info(_, S) ->
|
||||
{ok, S}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue