         if @_connected
             return @_conn.latency
 
-    _fix_connection: (delete_cookies) =>
-        if delete_cookies
-            console.log("websocket -- deleting haproxy cookies")
-            document.cookie = 'SMCSERVERID3=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
+    _delete_websocket_cookie: =>
+        console.log('websocket -- delete cookie')
+        misc_page.delete_cookie('SMCSERVERID3')
+
+    _fix_connection: =>
         console.log("websocket --_fix_connection... ")
+        @_delete_websocket_cookie()
         @_conn.end()
         @_conn.open()
 

                min     : 1000
                factor  : 1.3
                retries : 100000
        conn = new Primus(url, opts)

        @_conn = conn

            @_num_attempts = opts.attempt
            @emit("disconnected", "close") # This just informs everybody that we *are* disconnected.
            conn.removeAllListeners('data')
            @_delete_websocket_cookie()
            log("reconnect scheduled (attempt #{opts.attempt} out of #{opts.retries})")

        conn.on 'reconnect', =>
