Skip to content

Commit b56e55e

Browse files
committed
dev
1 parent c657f50 commit b56e55e

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/infrastructure/transport/ctproto.transport.ts

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CTProtoClient } from 'ctproto';
2-
import { nanoid } from 'nanoid';
32

43
interface AuthRequestPayload {
54
token: string;
@@ -37,26 +36,17 @@ export default class CtprotoTransport {
3736
ApiUpdate
3837
>;
3938

40-
private reconnectAttempts = 0;
41-
private readonly maxReconnectAttempts = 5;
42-
4339
constructor(apiUrl: string, authToken: string) {
4440
this.client = new CTProtoClient<AuthRequestPayload, AuthResponsePayload, ApiRequest, ApiResponse, ApiUpdate>({
4541
apiUrl,
4642
authRequestPayload: { token: authToken },
4743
onAuth: (response) => {
4844
console.log('✅ Аутентификация успешна:', response);
49-
this.reconnectAttempts = 0; // Сброс счётчика попыток
5045
},
5146
onMessage: (message) => {
5247
console.log('📩 Получено сообщение от сервера:', message);
5348
},
54-
onError: (error) => {
55-
console.error('❌ Ошибка CTProto:', error);
56-
},
57-
onDisconnect: (reason) => {
58-
console.warn('⚠ CTProto отключен:', reason);
59-
},
49+
disableLogs: false,
6050
});
6151
}
6252

@@ -71,12 +61,4 @@ export default class CtprotoTransport {
7161
payload
7262
);
7363
}
74-
75-
/**
76-
* Подписка на входящие сообщения
77-
* @param callback - Функция обработки сообщений
78-
*/
79-
public on(callback: (message: ApiResponse | ApiUpdate) => void): void {
80-
this.client.onMessage = callback;
81-
}
8264
}

0 commit comments

Comments
 (0)