From 409431b1e7c510ded48b1a95c63c7740199c68a2 Mon Sep 17 00:00:00 2001 From: Chris McCord Date: Thu, 10 Feb 2022 13:40:58 -0500 Subject: [PATCH] Fix ping on reconnect --- assets/js/app.js | 4 ++++ config/dev.exs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/app.js b/assets/js/app.js index 516686a..4432fb5 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -191,6 +191,10 @@ Hooks.Ping = { }) this.ping(null) }, + reconnected(){ + clearTimeout(this.timer) + this.ping(null) + }, destroyed(){ clearTimeout(this.timer) }, ping(rtt){ this.nowMs = Date.now() diff --git a/config/dev.exs b/config/dev.exs index 51add3e..60fff1a 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -39,7 +39,7 @@ config :live_beats, LiveBeats.ReplicaRepo, config :live_beats, LiveBeatsWeb.Endpoint, # Binding to loopback ipv4 address prevents access from other machines. # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. - http: [ip: {127, 0, 0, 1}, port: 4000], + http: [ip: {0, 0, 0, 0}, port: 4000], debug_errors: true, code_reloader: true, check_origin: false,