import { defineBoot } from '#q-app/wrappers';
import type { Socket } from 'socket.io-client';
import { io } from 'socket.io-client';
import type { ServerToClientEvents, ClientToServerEvents } from 'components/models';


const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io('/', {
  autoConnect: true,
  transports: ['websocket', 'webtransport', 'polling'],
});

export default defineBoot(({ app }) => {
  app.config.globalProperties.$socket = socket;
});

export { socket };
