|
@@ -36,7 +36,7 @@ export class Client {
|
36
|
36
|
}
|
37
|
37
|
|
38
|
38
|
let _this = this;
|
39
|
|
- this.addMessageListener(0, function(data) {
|
|
39
|
+ this.addMessageListener(0, function (data) {
|
40
|
40
|
let code = _this.getResponseProperty('code');
|
41
|
41
|
if (typeof code !== 'undefined') {
|
42
|
42
|
let message = _this.getResponseProperty('message');
|
|
@@ -93,7 +93,7 @@ export class Client {
|
93
|
93
|
let _this = this;
|
94
|
94
|
let sequence = new Date().getTime();
|
95
|
95
|
let listener = Utils.crc32(operator) + sequence;
|
96
|
|
- this.requestCallback[listener] = function(data) {
|
|
96
|
+ this.requestCallback[listener] = function (data) {
|
97
|
97
|
let code = _this.getResponseProperty('code');
|
98
|
98
|
if (typeof code !== 'undefined') {
|
99
|
99
|
let message = _this.getResponseProperty('message');
|
|
@@ -206,7 +206,7 @@ export class Client {
|
206
|
206
|
|
207
|
207
|
ws.binaryType = 'blob';
|
208
|
208
|
|
209
|
|
- ws.onopen = function(ev) {
|
|
209
|
+ ws.onopen = function (ev) {
|
210
|
210
|
_this.reconnectTimes = 0;
|
211
|
211
|
if (
|
212
|
212
|
readyStateCallback.hasOwnProperty('onOpen') &&
|
|
@@ -216,7 +216,7 @@ export class Client {
|
216
|
216
|
}
|
217
|
217
|
};
|
218
|
218
|
|
219
|
|
- ws.onclose = function(ev) {
|
|
219
|
+ ws.onclose = function (ev) {
|
220
|
220
|
_this.reconnect();
|
221
|
221
|
if (
|
222
|
222
|
readyStateCallback.hasOwnProperty('onClose') &&
|
|
@@ -226,7 +226,7 @@ export class Client {
|
226
|
226
|
}
|
227
|
227
|
};
|
228
|
228
|
|
229
|
|
- ws.onerror = function(ev) {
|
|
229
|
+ ws.onerror = function (ev) {
|
230
|
230
|
_this.reconnect();
|
231
|
231
|
if (
|
232
|
232
|
readyStateCallback.hasOwnProperty('onError') &&
|
|
@@ -236,11 +236,11 @@ export class Client {
|
236
|
236
|
}
|
237
|
237
|
};
|
238
|
238
|
|
239
|
|
- ws.onmessage = function(ev) {
|
|
239
|
+ ws.onmessage = function (ev) {
|
240
|
240
|
if (ev.data instanceof Blob) {
|
241
|
241
|
let reader = new FileReader();
|
242
|
242
|
reader.readAsArrayBuffer(ev.data);
|
243
|
|
- reader.onload = function() {
|
|
243
|
+ reader.onload = function () {
|
244
|
244
|
try {
|
245
|
245
|
let packet = new Packet().unPack(this.result);
|
246
|
246
|
let packetLength = packet.headerLength + packet.bodyLength + 20;
|