changeset 92:1414765e0929

Fix to client to deal with annoying no-content responses from the lighttpd proxy.
author Atul Varma <varmaa@toolness.com>
date Sat, 02 May 2009 01:04:30 +0000
parents ef9ae587a0c8
children 3be28af79baf
files media/js/openwebchat.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/media/js/openwebchat.js	Fri May 01 17:50:08 2009 -0700
+++ b/media/js/openwebchat.js	Sat May 02 01:04:30 2009 +0000
@@ -90,8 +90,10 @@
        dataType: 'json',
        timeout: self.LISTEN_TIMEOUT,
        error: function(xhr, textStatus, errorThrown) {
-         if (textStatus == "timeout")
-           // Start another long poll.
+           if (textStatus == "timeout" ||
+               textStatus == "parsererror")
+           // Start another long poll ('parsererror' just means
+           // our content length was 0, which isn't valid JSON).
            self.listenForMessages(options);
          else
            options.onError([textStatus, errorThrown]);