All, I'm looking for a few ideas, as to how to detect when the connection to the browser is dropped. Basically I've got an external method which uses RESPONSE.write to send javascript to an already connected browser, this is then run and affects the page which is being viewed. OK, this works fine, *but* when the stop button is pressed on the browser the external method carries on happily running. The page in question is at https://media-1.ml.uwcm.ac.uk/pushy. Leave it a few seconds and you'll see the page update. Can anyone think of a way to detect when the connection is dropped? tia Phil phil.harris@zope.co.uk
Phil Harris writes:
I'm looking for a few ideas, as to how to detect when the connection to the browser is dropped. I fear you will need to modify ZServer for that.
ZServer decouples the production process from the delivery process, writing the data to a file if necessary. Dieter
Dieter Maurer wrote:
Phil Harris writes:
I'm looking for a few ideas, as to how to detect when the connection to the browser is dropped. I fear you will need to modify ZServer for that.
ZServer decouples the production process from the delivery process, writing the data to a file if necessary.
is this the reason that if you accidentally trigger a very expensive method through a browser you can't stop it by hitting the 'stop' button, you just have to watch your server crawl through the method and slowly come back to life? If so, this could really do with looking at :-S cheers, Chris
Chris Withers writes:
Dieter Maurer wrote:
I fear you will need to modify ZServer for that.
ZServer decouples the production process from the delivery process, writing the data to a file if necessary.
is this the reason that if you accidentally trigger a very expensive method through a browser you can't stop it by hitting the 'stop' button, you just have to watch your server crawl through the method and slowly come back to life? That is part of it.
As I told you in an earlier message, Python does not provide for means to interrupt/abort a thread. Therefore, if your method computes or waits for an external result, it is not interruptible. However, if ZServer would not decouple the response process, then the method could recognize the channel closure as soon as it writes to the channel. As I write this, I recognize that this is independent, of whether or not ZServer decouples. The channel could forward the error in any case, only with different means. However, this would usually only be effective for methods that use "RESPONSE.write" as normally, the complete result is computed before sending the response starts. Dieter
participants (3)
-
Chris Withers -
Dieter Maurer -
Phil Harris