SHA256
Добавить предпросмотр DM в push-уведомлениях
This commit is contained in:
@@ -132,13 +132,13 @@ export class WsJsonClient {
|
||||
return this.openPromise;
|
||||
}
|
||||
|
||||
async request(op, payload = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
||||
for (let attempt = 0; attempt < 2; attempt += 1) {
|
||||
async request(op, payload = {}, timeoutMs = DEFAULT_TIMEOUT_MS, { existingOnly = false } = {}) {
|
||||
for (let attempt = 0; !existingOnly && attempt < 2; attempt += 1) {
|
||||
await this.open();
|
||||
if (this.requestGuard) await this.requestGuard(op);
|
||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) break;
|
||||
}
|
||||
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
||||
if (!this.ws || this.ws.readyState !== WebSocket.OPEN || (existingOnly && !this.isSessionReady())) {
|
||||
throw new Error(t('remaining.websocket.websocket_connection_closed'));
|
||||
}
|
||||
const requestId = createRequestId(op);
|
||||
|
||||
Reference in New Issue
Block a user