(ua = 'control', disable = false)
| 5 | |
| 6 | class Socket { |
| 7 | constructor(ua = 'control', disable = false) { |
| 8 | this.uid = this.random(); |
| 9 | // this.group = parsed.group || 'prod'; |
| 10 | this.disable = disable; |
| 11 | this.socket = io('http://47.102.198.102:8080/', { |
| 12 | transports: ['websocket'], |
| 13 | query: { |
| 14 | ua, |
| 15 | group: 'prod', |
| 16 | }, |
| 17 | }); |
| 18 | this.isSpeaker = false; |
| 19 | this.speakerHandlers = []; |
| 20 | |
| 21 | this.socket.on('room', ({ speaker }) => { |
| 22 | this.isSpeaker = speaker === this.socket.id; |
| 23 | this.speakerHandlers.forEach((cb) => { |
| 24 | if (typeof cb === 'function') { |
| 25 | cb(this.isSpeaker); |
| 26 | } |
| 27 | }); |
| 28 | }); |
| 29 | } |
| 30 | |
| 31 | random = () => Date.now() + Math.random(); |
| 32 |
nothing calls this directly
no outgoing calls
no test coverage detected