// src/services/socket/index.js /** * Socket 服务统一导出 * 使用真实 Socket.IO 服务连接后端 */ import { socketService } from '../socketService'; // 导出 socket 服务 export const socket = socketService; export { socketService }; // ⚡ 新增:暴露 Socket 实例到 window(用于调试和验证) if (typeof window !== 'undefined') { window.socket = socketService; window.socketService = socketService; console.log( '%c[Socket Service] ✅ Socket instance exposed to window', 'color: #4CAF50; font-weight: bold; font-size: 14px;' ); console.log(' 📍 window.socket:', window.socket); console.log(' 📍 window.socketService:', window.socketService); console.log(' 📍 Socket.IO instance:', window.socket?.socket); console.log(' 📍 Connection status:', window.socket?.connected ? '✅ Connected' : '❌ Disconnected'); } // 打印当前使用的服务类型 console.log( '%c[Socket Service] Using REAL Socket Service', 'color: #4CAF50; font-weight: bold; font-size: 12px;' ); export default socket;