목록IO (1)
개발자의 logs
socket.io(실시간채팅) source code
//index.js const app = require('express')(); const http = require('http').Server(app); const io = require('socket.io')(http); const port = process.env.PORT || 3000; app.get('/', (req, res) => { res.sendFile(__dirname + '/index.html'); }); io.on('connection', (socket) => { socket.on('chat message', (msg) => { io.emit('chat message', msg); }); }); http.listen(port, () => { console.log(`Socket.IO s..
개발 공부지식/*개발 공부*
2022. 6. 26. 18:34