io.on("connection", (socket) => {
console.log("connection");
socket.on("disconnect", () => {
console.log("disconnect");
});
});
client
import { io } from "socket.io-client"
const socket = io("<http://localhost:8000>");
socket.emit("login", userName, (cb) => {
console.log("res", cb); // 서버에서 매개변수로 보낸 정보가 출력
});
socket.on("disconnect", () => {
console.log("disconnect");
});