Websocket handler: do not raise if handler is terminated before switching protocols
Closes #2131
This commit is contained in:
parent
cb06e98da2
commit
e16e8f9816
1 changed files with 4 additions and 0 deletions
|
@ -100,6 +100,10 @@ def websocket_info(:tick, state) do
|
|||
{:reply, :ping, %{state | timer: nil, count: 0}, :hibernate}
|
||||
end
|
||||
|
||||
# State can be `[]` only in case we terminate before switching to websocket,
|
||||
# we already log errors for these cases in `init/1`, so just do nothing here
|
||||
def terminate(_reason, _req, []), do: :ok
|
||||
|
||||
def terminate(reason, _req, state) do
|
||||
Logger.debug(
|
||||
"#{__MODULE__} terminating websocket connection for user #{
|
||||
|
|
Loading…
Reference in a new issue