[Twisted-web] Nevow - 'connection lost' javascript alert on page reloads

Matt Goodall matt at pollenation.net
Wed Nov 10 13:01:12 MST 2004


> I have even tried with the HEAD revision from subversion of Nevow, but
> the problem still persists!
>
> On page reloads (on loads), I get this javascript alert
> "The connection to the remote server was lost. The page may fail to
> work correctly. Reloading the page may fix the problem."
>
> Looking at liveevil.js
>             if (xmlhttp.responseText) {
>                 connect(outputNum + 1)
>                 eval(xmlhttp.responseText)
>             } else {
>                 alert('The connection to the remote server was lost.
> The page may fail to work correctly. Reloading the page may fix the
> problem.');
>             }
>
> xmlhttp.responseText is null !!  It is supposed to be null only
> connection problems.

In theory it is a connection problem. By leaving the current page the
browser shuts down all connections created by the page including the
liveevil connection. (You get the same message with Mozilla/Firefox by
merely hitting <Esc>.) Nevow needs a robust way of detecting when the
liveevil connection is legitimately closed as opposed to real errors, i.e.
the server disappearing.

I played around with the liveevil javascript for a couple of hours one
evening. It's easy enough to make liveevil reconnect when the
XMLHttpRequest's socket object is closed but I could not find a way to
determine the cause of the shutdown. That makes handling errors gracefully
quite difficult.

If anyone knows how to handle XMLHttpRequest errors then please post here
and we'll get a fix into Nevow.

Cheers, Matt

-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.




More information about the Twisted-web mailing list