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

Method _onMessage

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

Source from the content-addressed store, hash-verified

148 }
149
150 _onMessage(message) {
151 if (typeof message !== 'string') {
152 this._onChunkReceived(message);
153 return;
154 }
155 message = JSON.parse(message);
156 console.log('RTC:', message);
157 switch (message.type) {
158 case 'header':
159 this._onFileHeader(message);
160 break;
161 case 'partition':
162 this._onReceivedPartitionEnd(message);
163 break;
164 case 'partition-received':
165 this._sendNextPartition();
166 break;
167 case 'progress':
168 this._onDownloadProgress(message.progress);
169 break;
170 case 'transfer-complete':
171 this._onTransferCompleted();
172 break;
173 case 'text':
174 this._onTextReceived(message);
175 break;
176 }
177 }
178
179 _onFileHeader(header) {
180 this._lastProgress = 0;

Callers 1

_onChannelOpenedMethod · 0.45

Calls 7

_onChunkReceivedMethod · 0.95
_onFileHeaderMethod · 0.95
_sendNextPartitionMethod · 0.95
_onDownloadProgressMethod · 0.95
_onTransferCompletedMethod · 0.95
_onTextReceivedMethod · 0.95

Tested by

no test coverage detected