Please add '/' to the 'ws' in case ```loc.pathname``` is not terminated by a slash.

    this.addr = 'wss://' + loc.host + loc.pathname + '/ws';