5 Commits

  1. 2
      README.md
  2. 4
      index.js

2
README.md

@ -1,7 +1,7 @@
## Use case
cd to main project directory
<br>
run: node index.js // output: [listening on *:3000]
run: node index.js // output: [listening on *:3030]
### use pm2

4
index.js

@ -60,8 +60,8 @@ io.on('connection', async (socket) => {
app.post('/emit/:room', function (req, res) {
// console.log(req.body);
console.log('room is :','room-' + req.params.room);
console.log('message',req.body.data.title);
io.to('room-' + req.params.room).emit('room-event', req.body.data.title);
console.log('message',req.body.data);
io.to('room-' + req.params.room).emit('room-event', req.body.data);
// console.log(req.body.data);
// res.json(req.body.data)
res.send('done');

Loading…
Cancel
Save