remove connecting event.

This commit is contained in:
Miroslav Šedivý 2021-06-20 23:46:40 +02:00
parent 97a213c9b3
commit b9b311c6de
3 changed files with 1 additions and 16 deletions

View File

@ -33,11 +33,6 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
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<NekoConnectionEvents> {
})
// 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')

View File

@ -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<NekoWebRTCEvents> {
}
public async connect(sdp: string, iceServers: ICEServer[]): Promise<string> {
this._log.info(`connecting`)
if (!this.supported) {
throw new Error('browser does not support webrtc')
}
@ -83,7 +80,7 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
throw new Error('attempting to create peer while connected')
}
this.emit('connecting')
this._log.info(`connecting`)
this._peer = new RTCPeerConnection({ iceServers })

View File

@ -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<NekoWebSocketEvents> {
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')