Posts1 Getting a basic connection running Let's get straight to the code: // server/index.ts import { createServer } from "http"; import { Server } from "socket.io"; const httpServer = createServer(); const io = new Server(httpServer, { cors: { origin: "http://localhost:3000", }, }); io.on("connection", (socket) => { console.log("someone connected"); socket.emit("hey", "hihihihihii"); }); const PORT = process.env.PORT || 3001; httpServe.. 2021. 12. 17. 이전 1 다음