Skip to content

Commit 767b921

Browse files
authored
Make xhr transports resilient to onmessage errors
Fixes sockjs#563
1 parent 71876b3 commit 767b921

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/transport/receiver/xhr.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ XhrReceiver.prototype._chunkHandler = function(status, text) {
3737
return;
3838
}
3939

40-
for (var idx = -1; ; this.bufferPosition += idx + 1) {
40+
for (var idx = -1; ; ) {
4141
var buf = text.slice(this.bufferPosition);
4242
idx = buf.indexOf('\n');
4343
if (idx === -1) {
4444
break;
4545
}
46+
this.bufferPosition += idx + 1;
4647
var msg = buf.slice(0, idx);
4748
if (msg) {
4849
debug('message', msg);

0 commit comments

Comments
 (0)