Skip to content

Commit

Permalink
breaking: allow code 1005; don’t force close(1000)
Browse files Browse the repository at this point in the history
- Closes #3
  • Loading branch information
lukeed committed Jan 30, 2018
1 parent 4d5c9e3 commit f8771f0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function (url, opts) {
}

$.onclose = e => {
(e.code !== 1e3) && $.reconnect(e);
(e.code !== 1e3 && e.code !== 1005) && $.reconnect(e);
(opts.onclose || noop)(e);
};

Expand All @@ -21,7 +21,6 @@ export default function (url, opts) {

$.open = _ => {
ws = new WebSocket(url, opts.protocols);
fn=ws.close; ws.close=(x,y) => ws && fn.call(ws, x||1e3, y);
for (k in $) ws[k] = $[k];
return ws;
};
Expand Down

0 comments on commit f8771f0

Please sign in to comment.