mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-21 04:48:01 -05:00
17 lines
336 B
TypeScript
17 lines
336 B
TypeScript
import { Server, Socket } from "socket.io";
|
|
|
|
const io = new Server(8080);
|
|
|
|
io.on("connect", (socket: Socket) => {
|
|
console.log(`connect ${socket.id}`);
|
|
|
|
socket.on("ping", (cb) => {
|
|
console.log("ping");
|
|
cb();
|
|
});
|
|
|
|
socket.on("disconnect", () => {
|
|
console.log(`disconnect ${socket.id}`);
|
|
});
|
|
});
|