@cimo/websocket 1.5.49 → 1.5.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,7 +15,7 @@ export default class Manager {
|
|
|
15
15
|
checkStatus: (mode: string, callback: () => void) => void;
|
|
16
16
|
sendMessage: (mode: string, data: model.TsendData, tag?: string, timeout?: number) => void;
|
|
17
17
|
sendDataBroadcast: (data: model.TsendData) => void;
|
|
18
|
-
sendDataUpload: (
|
|
18
|
+
sendDataUpload: (fileName: string, file: ArrayBuffer) => void;
|
|
19
19
|
sendDataDirect: (dataValue: model.TsendData, clientId: string) => void;
|
|
20
20
|
receiveData: <T>(tag: string, callbackValue: model.IcallbackReceiveData<T>) => void;
|
|
21
21
|
receiveDataDownload: (callback: model.IcallbackReceiveDataDownload) => void;
|
|
@@ -172,8 +172,8 @@ class Manager {
|
|
|
172
172
|
sendDataBroadcast = (data) => {
|
|
173
173
|
this.sendMessage("text", data, "broadcast");
|
|
174
174
|
};
|
|
175
|
-
sendDataUpload = (
|
|
176
|
-
this.sendMessage("text",
|
|
175
|
+
sendDataUpload = (fileName, file) => {
|
|
176
|
+
this.sendMessage("text", fileName, "upload");
|
|
177
177
|
this.sendMessage("binary", file, "", 100);
|
|
178
178
|
};
|
|
179
179
|
sendDataDirect = (dataValue, clientId) => {
|
|
@@ -206,14 +206,14 @@ class Manager {
|
|
|
206
206
|
});
|
|
207
207
|
};
|
|
208
208
|
receiveDataDownload = (callback) => {
|
|
209
|
-
let
|
|
209
|
+
let fileName = "";
|
|
210
210
|
this.receiveData("download", (data) => {
|
|
211
211
|
if (typeof data === "string") {
|
|
212
|
-
|
|
212
|
+
fileName = data;
|
|
213
213
|
}
|
|
214
214
|
else {
|
|
215
|
-
callback(data,
|
|
216
|
-
|
|
215
|
+
callback(data, fileName);
|
|
216
|
+
fileName = "";
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
};
|
|
@@ -23,7 +23,7 @@ export default class Manager {
|
|
|
23
23
|
clientIdList: () => string[];
|
|
24
24
|
sendMessage: (mode: string, data: model.TsendData, tag: string | undefined, clientId: string, timeout?: number) => void;
|
|
25
25
|
sendDataBroadcast: (data: model.TsendData, excludeClientId?: string) => void;
|
|
26
|
-
sendDataDownload: (
|
|
26
|
+
sendDataDownload: (fileName: string, file: Buffer, clientId: string) => void;
|
|
27
27
|
receiveData: <T>(tag: string, callbackValue: model.IcallbackReceiveData<T>) => void;
|
|
28
28
|
receiveDataUpload: (callback: model.IcallbackReceiveDataUpload) => void;
|
|
29
29
|
}
|
|
@@ -347,8 +347,8 @@ class Manager {
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
};
|
|
350
|
-
sendDataDownload = (
|
|
351
|
-
this.sendMessage("text",
|
|
350
|
+
sendDataDownload = (fileName, file, clientId) => {
|
|
351
|
+
this.sendMessage("text", fileName, "download", clientId);
|
|
352
352
|
this.sendMessage("binary", file, "", clientId, 100);
|
|
353
353
|
};
|
|
354
354
|
receiveData = (tag, callbackValue) => {
|
|
@@ -370,14 +370,14 @@ class Manager {
|
|
|
370
370
|
});
|
|
371
371
|
};
|
|
372
372
|
receiveDataUpload = (callback) => {
|
|
373
|
-
let
|
|
373
|
+
let fileName = "";
|
|
374
374
|
this.receiveData("upload", (data, clientId) => {
|
|
375
375
|
if (typeof data === "string") {
|
|
376
|
-
|
|
376
|
+
fileName = data;
|
|
377
377
|
}
|
|
378
378
|
else {
|
|
379
|
-
callback(data,
|
|
380
|
-
|
|
379
|
+
callback(data, fileName, clientId);
|
|
380
|
+
fileName = "";
|
|
381
381
|
}
|
|
382
382
|
});
|
|
383
383
|
};
|
|
@@ -25,7 +25,7 @@ export interface IcallbackReceiveData<T> {
|
|
|
25
25
|
(data: T, clientId: string): void;
|
|
26
26
|
}
|
|
27
27
|
export interface IcallbackReceiveDataUpload {
|
|
28
|
-
(dataList: Buffer[],
|
|
28
|
+
(dataList: Buffer[], fileName: string, clientId: string): void;
|
|
29
29
|
}
|
|
30
30
|
export interface Imessage {
|
|
31
31
|
tag: string;
|