             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


            # 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

        # but can also be the result of a device attributes request, etc.
        @terminal.on 'data',  (data) =>
            @session.write_data(data)
            setTimeout(@reconnect_if_no_recent_data, 3000)

        # The terminal receives a 'set my title' message.
        @terminal.on 'title', (title) => @set_title(title)
