         $(".salvus-fullscreen-activate").show()
     $("a[href=#salvus-connection-reconnect]").find("i").removeClass('fa-spin')
 
+ping_time_smooth = null
 salvus_client.on "ping", (ping_time) ->
     last_ping_time = ping_time
-    $(".salvus-connection-status-ping-time").html("#{ping_time}ms")
+    ping_time_smooth ?= ping_time
+    # reset outside 3x
+    if ping_time > 3 * ping_time_smooth or ping_time_smooth > 3 * ping_time
+        ping_time_smooth = ping_time
+    else
+        decay = 1 - Math.exp(-1)
+        ping_time_smooth = decay * ping_time_smooth + (1-decay) * ping_time
+    $(".salvus-connection-status-ping-time").html("#{Math.floor(ping_time_smooth)}ms")
 
 show_connection_information = () ->
     dialog = $(".salvus-connection-info")

    last_ping_time = ''

salvus_client.on "connecting", () ->
    $(".salvus-connection-status-disconnected").hide()
    $(".salvus-connection-status-connected").hide()
    $(".salvus-connection-status-connecting").show()
    $(".salvus-fullscreen-activate").hide()
    $(".salvus-connection-status-ping-time").html('')
    last_ping_time = ''
    $("a[href=#salvus-connection-reconnect]").find("i").addClass('fa-spin')

salvus_client.on "connected", () ->
    $(".salvus-connection-status-disconnected").hide()
    $(".salvus-connection-status-connecting").hide()
    $(".salvus-connection-status-connected").show()


last_ping_time = ''

network_connect_state = null
network_connect_timer = null
network_connect_timer_stop = () ->
    if network_connect_timer?
        window.clearTimeout(network_connect_timer)
        network_connect_timer = null

salvus_client.on "disconnected", (state) ->
    state ?= "disconnected"
    network_connect_timer_stop()
    network_connect_state = 'disconnected'
    $(".salvus-connection-status-connected").hide()
    $(".salvus-connection-status-connecting").hide()
    $(".salvus-connection-status-disconnected").html(state)
