add new api internal class.

This commit is contained in:
Miroslav Šedivý 2020-11-29 15:34:52 +01:00
parent 84e4f22524
commit ac9ac7ac69
3 changed files with 39 additions and 3 deletions

View file

@ -32,8 +32,7 @@ export class NekoWebSocket extends EventEmitter<NekoWebSocketEvents> {
this.emit('connecting')
const ws_url = url.replace(/^http/, 'ws').replace(/\/$|\/ws$/, '')
this._ws = new WebSocket(`${ws_url}/ws?id=${encodeURIComponent(id)}&secret=${encodeURIComponent(secret)}`)
this._ws = new WebSocket(`${url}/ws?id=${encodeURIComponent(id)}&secret=${encodeURIComponent(secret)}`)
this._log.debug(`connecting to ${this._ws.url}`)
this._ws.onopen = this.onConnected.bind(this)