Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac committed Dec 20, 2016
1 parent 2bc8786 commit 66ee764
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions js/src/api/transport/ws/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import TransportError from '../error';

/* global WebSocket */
export default class Ws extends JsonRpcBase {
constructor (url, token) {
constructor (url, token, connect = true) {
super();

this._url = url;
Expand All @@ -39,14 +39,18 @@ export default class Ws extends JsonRpcBase {
this._connectPromise = null;
this._connectPromiseFunctions = {};

// this.connect();
if (connect) {
this.connect();
}
}

updateToken (token) {
updateToken (token, connect = true) {
this._token = token;
// this._autoConnect = true;

// this.connect();
if (connect) {
this.connect();
}
}

connect () {
Expand Down
4 changes: 2 additions & 2 deletions js/src/secureApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const sysuiToken = window.localStorage.getItem('sysuiToken');

export default class SecureApi extends Api {
constructor (url, nextToken) {
super(new Api.Transport.Ws(url, sysuiToken));
super(new Api.Transport.Ws(url, sysuiToken, false));

this._url = url;
this._isConnecting = true;
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class SecureApi extends Api {
}

updateToken (token) {
this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, ''));
this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, ''), false);
return this._followConnection();
// DEBUG: console.log('SecureApi:updateToken', this._transport.token, connectState);
}
Expand Down

0 comments on commit 66ee764

Please sign in to comment.