MCPcopy
hub / github.com/SnapDrop/snapdrop / onServerMessage

Method onServerMessage

client/scripts/network.js:277–292  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

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);

Callers 1

_onMessageMethod · 0.80

Calls 3

_connectMethod · 0.95
_onDescriptionMethod · 0.95
_onErrorMethod · 0.95

Tested by

no test coverage detected