comparison media/js/openwebchat.js @ 93:3be28af79baf

Fixed a really bad bug in timeout detection.
author Atul Varma <varmaa@toolness.com>
date Fri, 01 May 2009 18:53:07 -0700
parents 1414765e0929
children
comparison
equal deleted inserted replaced
92:1414765e0929 93:3be28af79baf
88 url: 'listen', 88 url: 'listen',
89 data: {start: options.storage.length}, 89 data: {start: options.storage.length},
90 dataType: 'json', 90 dataType: 'json',
91 timeout: self.LISTEN_TIMEOUT, 91 timeout: self.LISTEN_TIMEOUT,
92 error: function(xhr, textStatus, errorThrown) { 92 error: function(xhr, textStatus, errorThrown) {
93 if (textStatus == "timeout" || 93 if (textStatus == "timeout")
94 textStatus == "parsererror") 94 // Start another long poll.
95 // Start another long poll ('parsererror' just means
96 // our content length was 0, which isn't valid JSON).
97 self.listenForMessages(options); 95 self.listenForMessages(options);
98 else 96 else
99 options.onError([textStatus, errorThrown]); 97 options.onError([textStatus, errorThrown]);
100 }, 98 },
101 success: function(data, textStatus) { 99 success: function(data, textStatus) {