(message)
| 275 | } |
| 276 | |
| 277 | onServerMessage(message) { |
| 278 | if (!this._conn) this._connect(message.sender, false); |
| 279 | |
| 280 | if (message.sdp) { |
| 281 | this._conn.setRemoteDescription(new RTCSessionDescription(message.sdp)) |
| 282 | .then( _ => { |
| 283 | if (message.sdp.type === 'offer') { |
| 284 | return this._conn.createAnswer() |
| 285 | .then(d => this._onDescription(d)); |
| 286 | } |
| 287 | }) |
| 288 | .catch(e => this._onError(e)); |
| 289 | } else if (message.ice) { |
| 290 | this._conn.addIceCandidate(new RTCIceCandidate(message.ice)); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | _onChannelOpened(event) { |
| 295 | console.log('RTC: channel opened with', this._peerId); |
no test coverage detected