i got this error TypeError require listen is not a function

0 votes
var express = require('express')

  , http = require('http');

//make sure you keep this order

var app = express();

var server = http.createServer(app);

var io = require('socket.io').listen(server);

io.on('connection',(socket)=>{

    console.log('Socket opened');

    socket.on('new_joinee',(data)=>{

        console.log('Message from client',data)

        socket.join(data.room);

        socket.broadcast.emit('server_new_joinee',{

            msg: data.name + 'successfully joined room'+data.room

        })

       

    })

})

server.listen(8083,()=>{

    console.log('Server starts')

})

module.exports = app;
Jan 21, 2021 in Java by tanimowo

edited Mar 4 18 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP