Initial commit: Lageplan v1.0 - Next.js 15.5, React 19

This commit is contained in:
Pepe Ziberi
2026-02-21 11:57:44 +01:00
commit adf3dc8c1d
167 changed files with 34265 additions and 0 deletions

25
src/lib/socket.ts Normal file
View File

@@ -0,0 +1,25 @@
'use client'
import { io, Socket } from 'socket.io-client'
let socket: Socket | null = null
export function getSocket(): Socket {
if (!socket) {
socket = io({
path: '/socket.io',
transports: ['polling', 'websocket'],
upgrade: true,
reconnectionAttempts: 10,
reconnectionDelay: 2000,
timeout: 10000,
})
socket.on('connect', () => {
console.log('[Socket.io] Connected:', socket?.id)
})
socket.on('connect_error', (err) => {
console.warn('[Socket.io] Connection error:', err.message)
})
}
return socket
}