앱 실시간 차트 갱신오류 수정
This commit is contained in:
@@ -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`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user