Skip to content

Commit 9712c24

Browse files
jcheng5whimsicallyson
authored andcommitted
Make xhr transports resilient to onmessage errors
Fixes sockjs#563
1 parent 5027318 commit 9712c24

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/transport/receiver/xhr.js

Lines changed: 2 additions & 1 deletion
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)