ping-pong
ci/woodpecker/push/docs Pipeline is pending Details
ci/woodpecker/push/release Pipeline is pending Details
ci/woodpecker/push/test Pipeline is pending Details

This commit is contained in:
FloatingGhost 2022-07-22 15:36:15 +01:00
parent 359e399b08
commit e9b7d2409f
1 changed files with 4 additions and 0 deletions

View File

@ -64,6 +64,10 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
# We only receive pings for now
def websocket_handle(:ping, state), do: {:ok, state}
def websocket_handle({:text, "ping"}, state) do
if state.timer, do: Process.cancel_timer(state.timer)
{:reply, {:text, "pong"}, %{state | timer: timer()}}
end
def websocket_handle(frame, state) do
Logger.error("#{__MODULE__} received frame: #{inspect(frame)}")