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') Vue.set(this._state, 'type', 'webrtc')
// websocket // websocket
this.websocket.on('connecting', () => {
if (this._state.status !== 'connecting') {
Vue.set(this._state, 'status', 'connecting')
}
})
this.websocket.on('connected', () => { this.websocket.on('connected', () => {
if (this.websocket.connected && this.webrtc.connected) { if (this.websocket.connected && this.webrtc.connected) {
Vue.set(this._state, 'status', 'connected') Vue.set(this._state, 'status', 'connected')
@ -52,11 +47,6 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
}) })
// webrtc // webrtc
this.webrtc.on('connecting', () => {
if (this._state.status !== 'connecting') {
Vue.set(this._state, 'status', 'connecting')
}
})
this.webrtc.on('connected', () => { this.webrtc.on('connected', () => {
if (this.websocket.connected && this.webrtc.connected) { if (this.websocket.connected && this.webrtc.connected) {
Vue.set(this._state, 'status', 'connected') Vue.set(this._state, 'status', 'connected')

View File

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

View File

@ -2,7 +2,6 @@ import EventEmitter from 'eventemitter3'
import { Logger } from '../utils/logger' import { Logger } from '../utils/logger'
export interface NekoWebSocketEvents { export interface NekoWebSocketEvents {
connecting: () => void
connected: () => void connected: () => void
disconnected: (error?: Error) => void disconnected: (error?: Error) => void
message: (event: string, payload: any) => void message: (event: string, payload: any) => void
@ -43,7 +42,6 @@ export class NekoWebSocket extends EventEmitter<NekoWebSocketEvents> {
this._ws = new WebSocket(url) this._ws = new WebSocket(url)
this._log.info(`connecting`) this._log.info(`connecting`)
this.emit('connecting')
this._ws.onopen = this.onConnected.bind(this) this._ws.onopen = this.onConnected.bind(this)
this._ws.onclose = this.onDisconnected.bind(this, 'close') this._ws.onclose = this.onDisconnected.bind(this, 'close')