mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-11-25 01:10:59 +00:00
Fix ping
This commit is contained in:
parent
8cd6048d4b
commit
1975f85cfe
2 changed files with 1 additions and 2 deletions
|
@ -183,7 +183,7 @@ Hooks.Ping = {
|
||||||
this.handleEvent("pong", () => {
|
this.handleEvent("pong", () => {
|
||||||
let rtt = Date.now() - this.nowMs
|
let rtt = Date.now() - this.nowMs
|
||||||
this.el.innerText = `ping: ${rtt}ms`
|
this.el.innerText = `ping: ${rtt}ms`
|
||||||
this.timer = setTimeout(() => this.ping(rtt), 100)
|
this.timer = setTimeout(() => this.ping(rtt), 1000)
|
||||||
})
|
})
|
||||||
this.ping(null)
|
this.ping(null)
|
||||||
},
|
},
|
||||||
|
|
|
@ -93,7 +93,6 @@ defmodule LiveBeatsWeb.Presence.BadgeComponent do
|
||||||
|
|
||||||
def update(%{action: {:ping, action}}, socket) do
|
def update(%{action: {:ping, action}}, socket) do
|
||||||
%{user: user, ping: ping, region: region} = action
|
%{user: user, ping: ping, region: region} = action
|
||||||
|
|
||||||
{:ok, assign(socket, presence: user, ping: ping, region: region)}
|
{:ok, assign(socket, presence: user, ping: ping, region: region)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue