Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 9, 2021 02:02 pm GMT

New to node.js and struggling with socket.io

Hi all,

Nervous first post but really need some help. I'm working on a Web application for p2p communication (both video and text).

The video communication works (some teething issues), but my main issue is getting user socket.id. specifically the user just having connected.

I have tried many things including:
Socket.on("connected", () {
console.log(socket.id);
});

All I get is "undefined". Yet if I run te same console.log code after the page loads I can get it displayed.

Not sure how to work with that.

I want to store the socket.id and username in an object/array

Thank you


Original Link: https://dev.to/fletch0132/new-to-node-js-and-struggling-with-socket-io-o75

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To