|
@@ -97,6 +97,7 @@ var WebSocketClient = (function () {
|
97
|
97
|
}
|
98
|
98
|
catch (err) {
|
99
|
99
|
console.error(err);
|
|
100
|
+ reject(err);
|
100
|
101
|
}
|
101
|
102
|
return [4, this.connect()];
|
102
|
103
|
case 1:
|
|
@@ -166,23 +167,45 @@ var WebSocketClient = (function () {
|
166
|
167
|
return __awaiter(this, void 0, void 0, function () {
|
167
|
168
|
var tk, data;
|
168
|
169
|
return __generator(this, function (_a) {
|
169
|
|
- tk = this.token;
|
170
|
|
- data = this.request('/v1/session/bind/uid/by/token', { token: tk });
|
171
|
|
- return [2, data || true];
|
|
170
|
+ switch (_a.label) {
|
|
171
|
+ case 0:
|
|
172
|
+ tk = this.token;
|
|
173
|
+ return [4, this.request('/v1/session/bind/uid/by/token', { token: tk })];
|
|
174
|
+ case 1:
|
|
175
|
+ data = _a.sent();
|
|
176
|
+ return [2, data || true];
|
|
177
|
+ }
|
172
|
178
|
});
|
173
|
179
|
});
|
174
|
180
|
};
|
175
|
181
|
WebSocketClient.prototype.onMessage = function (callback) {
|
176
|
|
- this.on('/v1/message/listener', callback);
|
|
182
|
+ return __awaiter(this, void 0, void 0, function () {
|
|
183
|
+ return __generator(this, function (_a) {
|
|
184
|
+ this.on('/v1/message/listener', callback);
|
|
185
|
+ return [2];
|
|
186
|
+ });
|
|
187
|
+ });
|
177
|
188
|
};
|
178
|
189
|
WebSocketClient.prototype.sendMessage = function (data) {
|
179
|
|
- return this.request('/v1/send/message', data);
|
|
190
|
+ return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+ return __generator(this, function (_a) {
|
|
192
|
+ return [2, this.request('/v1/send/message', data)];
|
|
193
|
+ });
|
|
194
|
+ });
|
180
|
195
|
};
|
181
|
196
|
WebSocketClient.prototype.markServiced = function (data) {
|
182
|
|
- return this.request('/v1/mark/message/serviced', data);
|
|
197
|
+ return __awaiter(this, void 0, void 0, function () {
|
|
198
|
+ return __generator(this, function (_a) {
|
|
199
|
+ return [2, this.request('/v1/mark/message/serviced', data)];
|
|
200
|
+ });
|
|
201
|
+ });
|
183
|
202
|
};
|
184
|
203
|
WebSocketClient.prototype.getHistoryMessage = function (data) {
|
185
|
|
- return this.request('/v1/history/message', data);
|
|
204
|
+ return __awaiter(this, void 0, void 0, function () {
|
|
205
|
+ return __generator(this, function (_a) {
|
|
206
|
+ return [2, this.request('/v1/history/message', data)];
|
|
207
|
+ });
|
|
208
|
+ });
|
186
|
209
|
};
|
187
|
210
|
return WebSocketClient;
|
188
|
211
|
}());
|