@daeryun/dr_components 0.8.27 → 0.8.29
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.
|
@@ -228,7 +228,7 @@ export function connectWebSocket(wsUrl, token, onMessage, onOpen, onClose, onErr
|
|
|
228
228
|
console.log('[웹소켓 연결 시작] 연결 URL:', connectionUrl);
|
|
229
229
|
try {
|
|
230
230
|
const socket = new WebSocket(connectionUrl);
|
|
231
|
-
|
|
231
|
+
const setupSocketHandlers = (socket) => {
|
|
232
232
|
socket.onopen = event => {
|
|
233
233
|
console.log('[웹소켓 연결 성공]');
|
|
234
234
|
reconnectAttempts = 0;
|
|
@@ -254,7 +254,7 @@ export function connectWebSocket(wsUrl, token, onMessage, onOpen, onClose, onErr
|
|
|
254
254
|
console.log(`[재연결 시도] ${reconnectAttempts}회... ${RECONNECT_DELAY_MS}ms 후`);
|
|
255
255
|
yield new Promise(res => setTimeout(res, RECONNECT_DELAY_MS));
|
|
256
256
|
socket = new WebSocket(connectionUrl);
|
|
257
|
-
setupSocketHandlers(socket); //
|
|
257
|
+
setupSocketHandlers(socket); // 재귀 호출
|
|
258
258
|
}
|
|
259
259
|
else {
|
|
260
260
|
console.error('[웹소켓 재연결 실패] 최대 재시도 초과');
|
|
@@ -269,7 +269,7 @@ export function connectWebSocket(wsUrl, token, onMessage, onOpen, onClose, onErr
|
|
|
269
269
|
if (onError)
|
|
270
270
|
onError(event);
|
|
271
271
|
};
|
|
272
|
-
}
|
|
272
|
+
};
|
|
273
273
|
setupSocketHandlers(socket);
|
|
274
274
|
return socket;
|
|
275
275
|
}
|
|
@@ -421,6 +421,9 @@ function retryable(fn_1) {
|
|
|
421
421
|
*/
|
|
422
422
|
export function initializeDaeryuntalk(hashValue, onWebSocketConnected, onWebSocketMessage, version) {
|
|
423
423
|
return __awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
if (typeof window !== 'undefined' && hashValue) {
|
|
425
|
+
localStorage.removeItem('daeryunchatinquirytoken');
|
|
426
|
+
}
|
|
424
427
|
console.log('[Daeryuntalk 초기화 시작] 전체 흐름 실행', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
425
428
|
try {
|
|
426
429
|
console.log('[Daeryuntalk 초기화] 전체 흐름 시작');
|
|
@@ -285,7 +285,7 @@ export function connectWebSocket(
|
|
|
285
285
|
try {
|
|
286
286
|
const socket = new WebSocket(connectionUrl);
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
const setupSocketHandlers = (socket: WebSocket) => {
|
|
289
289
|
socket.onopen = event => {
|
|
290
290
|
console.log('[웹소켓 연결 성공]');
|
|
291
291
|
reconnectAttempts = 0;
|
|
@@ -314,7 +314,7 @@ export function connectWebSocket(
|
|
|
314
314
|
await new Promise(res => setTimeout(res, RECONNECT_DELAY_MS));
|
|
315
315
|
|
|
316
316
|
socket = new WebSocket(connectionUrl);
|
|
317
|
-
setupSocketHandlers(socket); //
|
|
317
|
+
setupSocketHandlers(socket); // 재귀 호출
|
|
318
318
|
} else {
|
|
319
319
|
console.error('[웹소켓 재연결 실패] 최대 재시도 초과');
|
|
320
320
|
if (onReconnectFail) onReconnectFail();
|
|
@@ -326,7 +326,7 @@ export function connectWebSocket(
|
|
|
326
326
|
console.error('[웹소켓 오류]', event);
|
|
327
327
|
if (onError) onError(event);
|
|
328
328
|
};
|
|
329
|
-
}
|
|
329
|
+
};
|
|
330
330
|
|
|
331
331
|
setupSocketHandlers(socket);
|
|
332
332
|
|
|
@@ -528,6 +528,10 @@ export async function initializeDaeryuntalk(
|
|
|
528
528
|
socket: WebSocket;
|
|
529
529
|
hashAuth: any;
|
|
530
530
|
}> {
|
|
531
|
+
|
|
532
|
+
if (typeof window !== 'undefined' && hashValue) {
|
|
533
|
+
localStorage.removeItem('daeryunchatinquirytoken');
|
|
534
|
+
}
|
|
531
535
|
console.log(
|
|
532
536
|
'[Daeryuntalk 초기화 시작] 전체 흐름 실행',
|
|
533
537
|
version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`
|