From b9b311c6defdda26f463e3b85e31de5ef730baca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 20 Jun 2021 23:46:40 +0200 Subject: [PATCH] remove connecting event. --- src/component/internal/connection.ts | 10 ---------- src/component/internal/webrtc.ts | 5 +---- src/component/internal/websocket.ts | 2 -- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/component/internal/connection.ts b/src/component/internal/connection.ts index fc1340dd..9c9e274e 100644 --- a/src/component/internal/connection.ts +++ b/src/component/internal/connection.ts @@ -33,11 +33,6 @@ export class NekoConnection extends EventEmitter { Vue.set(this._state, 'type', 'webrtc') // websocket - this.websocket.on('connecting', () => { - if (this._state.status !== 'connecting') { - Vue.set(this._state, 'status', 'connecting') - } - }) this.websocket.on('connected', () => { if (this.websocket.connected && this.webrtc.connected) { Vue.set(this._state, 'status', 'connected') @@ -52,11 +47,6 @@ export class NekoConnection extends EventEmitter { }) // webrtc - this.webrtc.on('connecting', () => { - if (this._state.status !== 'connecting') { - Vue.set(this._state, 'status', 'connecting') - } - }) this.webrtc.on('connected', () => { if (this.websocket.connected && this.webrtc.connected) { Vue.set(this._state, 'status', 'connected') diff --git a/src/component/internal/webrtc.ts b/src/component/internal/webrtc.ts index fce19385..1c6d0502 100644 --- a/src/component/internal/webrtc.ts +++ b/src/component/internal/webrtc.ts @@ -25,7 +25,6 @@ export interface ICEServer { } export interface NekoWebRTCEvents { - connecting: () => void connected: () => void disconnected: (error?: Error) => void track: (event: RTCTrackEvent) => void @@ -73,8 +72,6 @@ export class NekoWebRTC extends EventEmitter { } public async connect(sdp: string, iceServers: ICEServer[]): Promise { - this._log.info(`connecting`) - if (!this.supported) { throw new Error('browser does not support webrtc') } @@ -83,7 +80,7 @@ export class NekoWebRTC extends EventEmitter { throw new Error('attempting to create peer while connected') } - this.emit('connecting') + this._log.info(`connecting`) this._peer = new RTCPeerConnection({ iceServers }) diff --git a/src/component/internal/websocket.ts b/src/component/internal/websocket.ts index cf91275d..03301c51 100644 --- a/src/component/internal/websocket.ts +++ b/src/component/internal/websocket.ts @@ -2,7 +2,6 @@ import EventEmitter from 'eventemitter3' import { Logger } from '../utils/logger' export interface NekoWebSocketEvents { - connecting: () => void connected: () => void disconnected: (error?: Error) => void message: (event: string, payload: any) => void @@ -43,7 +42,6 @@ export class NekoWebSocket extends EventEmitter { this._ws = new WebSocket(url) this._log.info(`connecting`) - this.emit('connecting') this._ws.onopen = this.onConnected.bind(this) this._ws.onclose = this.onDisconnected.bind(this, 'close')