                     @suggestions.table.push suggestion
                 @has_been_initialized.value = true
             
-            host = window.location.hostname
-            port = window.location.port
-            if port is ''
-                port = 13457
-
-            window.conn = new rethinkdb.net.HttpConnection 
-                host: host
-                port: port
+            @connect()
             window.r = rethinkdb.query
             window.R = r.R
+
+            @interval = setInterval @connect, 60*5*1000
 
             # We escape the last function because we are building a regex on top of it.
             @unsafe_to_safe_regexstr = []

            @codemirror.setCursor
                line: Infinity
                ch: Infinity

        initialize: =>
            if @has_been_initialized.value is false

            @input_query.destroy()
            @data_container.destroy()
            window.conn.close()
            clearInterval @interval

    
    class @InputQuery extends Backbone.View
