socket-io
Installation
SKILL.md
Socket.IO
Server Setup
import { Server } from 'socket.io';
import { createServer } from 'http';
const httpServer = createServer(app);
interface ServerToClientEvents {
message: (data: { user: string; text: string; timestamp: number }) => void;
userJoined: (user: string) => void;
}
interface ClientToServerEvents {
sendMessage: (text: string, callback: (status: 'ok' | 'error') => void) => void;
joinRoom: (room: string) => void;
}