diff --git a/lib/src/store.ts b/lib/src/store.ts index aad2ac8e..509077d7 100644 --- a/lib/src/store.ts +++ b/lib/src/store.ts @@ -411,7 +411,7 @@ export class Store { if (agent) { setCookieAuthentication(this, agent); this.webSockets.forEach(ws => { - authenticate(ws, this); + ws.readyState === ws.OPEN && authenticate(ws, this); }); this.resources.forEach(r => { if (r.isUnauthorized()) { @@ -425,7 +425,7 @@ export class Store { public setServerUrl(url: string): void { tryValidURL(url); - if (url.substr(-1) === '/') { + if (url.substring(-1) === '/') { throw Error('baseUrl should not have a trailing slash'); }