Saturday 18 November 2017

Multiple socket.io connection for the same page?

Hey all I need some serious help ahaha.So I am trying to create a real time message app using socket.io,express and AngularJS and it has been going well. I need to emit a private message to a socket user but it never catches the"on" event (If I emit to all sockets it works). After abit of debugging I noticed that when I first launch my app there are multiple socket connections for the same page. A exmaple of the code is below://Listen on the connection for incoming sockets io.on('connection',function (socket) { console.log("New new connection has been started");From the above console log I get the following:listening on *:3000 New new connection has been startedNew new connection has been startedNew new connection has been startedNew new connection has been startedNew new connection has been startedI have no idea why this is happening! I have been trying to fix this for days with no luck, IM DESPERATE AHAHAHAH

Submitted November 19, 2017 at 01:36AM by pd145

No comments:

Post a Comment