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

Method _connect

client/scripts/network.js:13–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 }
12
13 _connect() {
14 clearTimeout(this._reconnectTimer);
15 if (this._isConnected() || this._isConnecting()) return;
16 const ws = new WebSocket(this._endpoint());
17 ws.binaryType = 'arraybuffer';
18 ws.onopen = e => console.log('WS: server connected');
19 ws.onmessage = e => this._onMessage(e.data);
20 ws.onclose = e => this._onDisconnect();
21 ws.onerror = e => console.error(e);
22 this._socket = ws;
23 }
24
25 _onMessage(msg) {
26 msg = JSON.parse(msg);

Callers 3

constructorMethod · 0.95
_onDisconnectMethod · 0.95
_onVisibilityChangeMethod · 0.95

Calls 5

_isConnectedMethod · 0.95
_isConnectingMethod · 0.95
_endpointMethod · 0.95
_onMessageMethod · 0.95
_onDisconnectMethod · 0.95

Tested by

no test coverage detected