diff --git a/modules/javascript/src/main/webapp/javascript/atmosphere.js b/modules/javascript/src/main/webapp/javascript/atmosphere.js index deedd16b..b35afb0e 100644 --- a/modules/javascript/src/main/webapp/javascript/atmosphere.js +++ b/modules/javascript/src/main/webapp/javascript/atmosphere.js @@ -1688,8 +1688,11 @@ while (messageStart !== -1) { var str = message.substring(0, messageStart); var messageLength = +str; - if (isNaN(messageLength)) + if (isNaN(messageLength)) { + // Discard partial message, otherwise it would never recover from this condition + response.partialMessage = ''; throw new Error('message length "' + str + '" is not a number'); + } messageStart += request.messageDelimiter.length; if (messageStart + messageLength > message.length) { // message not complete, so there is no trailing messageDelimiter