aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/pages/api/socket.ts
blob: d03b157ff25fbd73c07aa56b34caec160b6ed084 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { NextApiRequest } from 'next';
import { initSocketIO, NextApiResponseWithSocket } from '@/lib/socket';

export default function handler(
  req: NextApiRequest,
  res: NextApiResponseWithSocket
) {
  // Initialize Socket.IO server
  initSocketIO(res);
  
  // Return a success response
  res.status(200).json({ success: true, message: 'Socket.IO server initialized' });
}

// Disable Next.js body parsing for WebSockets
export const config = {
  api: {
    bodyParser: false,
  },
};