앱 실시간 차트 갱신오류 수정

This commit is contained in:
Macbook
2026-06-14 19:33:01 +09:00
parent 5045a548a4
commit c105ae209b
4 changed files with 52 additions and 11 deletions
+7
View File
@@ -3,6 +3,8 @@
* 훅·차트마다 WebSocket 을 열면 모바일에서 429·재연결 폭주가 발생한다.
*/
import type { UpbitMessage } from './upbitApi';
import { isDesktop } from './platform';
import { getSecureApiOrigin } from './backendApi';
export type UpbitWsChannel = 'ticker' | 'orderbook' | 'trade';
@@ -36,6 +38,11 @@ let closingIntentionally = false;
let wsFailureLogged = false;
function getWsUrl(): string {
if (isDesktop()) {
const origin = getSecureApiOrigin().replace(/^http:\/\//i, 'https://');
const host = origin.replace(/^https:\/\//i, '');
return `wss://${host}/upbit-ws`;
}
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
return `${proto}://${window.location.host}/upbit-ws`;
}