Frameworks
Socket.IO Cheat Sheet
Print-ready cheat sheet for Socket.IO, organized for fast lookup, study, and desk-side use
Sample
What's in this cheat sheet
- Setup
- Events
- Emitting
- Broadcasting
- Rooms
- Namespaces
- Middleware
- Error Handling
- Acknowledgements
- Common Patterns
Server Setup (Node.js)
import { Server } from "socket.io";
const io = new Server(3000, {
cors: { origin: "http://localhost:5173" }
});
Client Setup
import { io } from "socket.io-client";
const socket = io("http://localhost:3000");
With Express
import express from "express";
import { createServer } from "http";
import { Server } from "socket.io";
const app = express();
const server = createServer(app);
const io = new Server(server);
Download the full cheat sheet for all sections, formatted for print
Download PDFDownloads
Choose the treatment that matches how you read
-
Recommended
Standard
B&W, ink-efficient. The default for laser printers and photocopies
Best for Printouts and desk-side reference
-
Color
Warm color accents for on-screen reading or color printers
Best for Screen reading or color printers
-
Reference Card
Maximum density, 4-column layout. Everything on one page
Best for Fast scanning and minimum paper use