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

Method _onConnection

server/index.js:30–44  ·  view source on GitHub ↗
(peer)

Source from the content-addressed store, hash-verified

28 }
29
30 _onConnection(peer) {
31 this._joinRoom(peer);
32 peer.socket.on('message', message => this._onMessage(peer, message));
33 peer.socket.on('error', console.error);
34 this._keepAlive(peer);
35
36 // send displayName
37 this._send(peer, {
38 type: 'display-name',
39 message: {
40 displayName: peer.name.displayName,
41 deviceName: peer.name.deviceName
42 }
43 });
44 }
45
46 _onHeaders(headers, response) {
47 if (response.headers.cookie && response.headers.cookie.indexOf('peerid=') > -1) return;

Callers 1

constructorMethod · 0.95

Calls 5

_joinRoomMethod · 0.95
_onMessageMethod · 0.95
_keepAliveMethod · 0.95
_sendMethod · 0.95
onMethod · 0.80

Tested by

no test coverage detected