                 @element.find("a[href=#refresh]").addClass('btn-success').find(".fa").addClass('fa-spin')
 
             @session.on 'reconnect', () =>
+                @_got_remote_data = new Date()
                 #console.log("terminal: reconnect")
                 @element.find(".salvus-console-terminal").css('opacity':'1')
                 @element.find("a[href=#refresh]").removeClass('btn-success').find(".fa").removeClass('fa-spin')


            # The remote server sends data back to us to display:
            @session.on 'data',  (data) =>
                #console.log("got #{data.length} data")
                if @_rendering_is_paused
                    @_render_buffer += data
                else

            catch e
                console.log("issue parsing message -- ", e)

    reconnect_if_no_recent_data: =>
        #console.log 'check for recent data'
        if not @_got_remote_data? or new Date() - @_got_remote_data >= 15000
            #console.log 'reconnecting since no recent data'
            @session?.reconnect()

    set_session: (session) =>
        if @session?
            # Don't allow set_session to be called multiple times, since both sessions could
