update pay ui
This commit is contained in:
@@ -382,7 +382,11 @@ export const useRealtimeQuote = (codes: string[] = []): UseRealtimeQuoteReturn =
|
||||
heartbeatRefs.current[exchange] = setInterval(() => {
|
||||
const ws = wsRefs.current[exchange];
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
ws.send(JSON.stringify({ type: 'ping' }));
|
||||
// 上交所使用 action: 'ping',深交所使用 type: 'ping'
|
||||
const pingMsg = exchange === 'SSE'
|
||||
? { action: 'ping' }
|
||||
: { type: 'ping' };
|
||||
ws.send(JSON.stringify(pingMsg));
|
||||
}
|
||||
}, HEARTBEAT_INTERVAL);
|
||||
}, [stopHeartbeat]);
|
||||
@@ -409,10 +413,20 @@ export const useRealtimeQuote = (codes: string[] = []): UseRealtimeQuoteReturn =
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const anyMsg = msg as any;
|
||||
|
||||
// 心跳响应
|
||||
if (msg.type === 'pong') return;
|
||||
// 心跳响应(上交所和深交所格式可能不同)
|
||||
if (msg.type === 'pong' || anyMsg.action === 'pong') return;
|
||||
|
||||
if (exchange === 'SSE') {
|
||||
// 上交所消息处理
|
||||
if (msg.type === 'subscribed') {
|
||||
logger.info('FlexScreen', 'SSE 订阅成功', { channels: anyMsg.channels });
|
||||
return;
|
||||
}
|
||||
if (msg.type === 'error') {
|
||||
logger.error('FlexScreen', 'SSE WebSocket 错误', { message: anyMsg.message });
|
||||
return;
|
||||
}
|
||||
// 处理行情数据
|
||||
const result = handleSSEMessage(
|
||||
msg as SSEMessage,
|
||||
subscribedCodes.current.SSE,
|
||||
|
||||
Reference in New Issue
Block a user