I am writing a web app. I want users to be able to go to a URL and start a new "session" of my app. They can Slack their friends/colleagues the URL and then everybody is in a socket-connected scenario where the originator can pose questions to the group, who can answer anonymously.
Right now, I initialize the user type such that the person who started the session can ask the questions. I was planning on the fact that going to the same URL in a different tab would not have that initialization process, and therefore I could do all kinds of things differently (UI, etc). I am starting to wonder
if there's a better what the better way to do this is.
I would like for users to not have to log in, unless at the end they want to save their results. I also don't know exactly how (if?) actual server sessions play into this.
I have something that generates a random string that becomes the route of the application with each newly opened session. I was hoping that would be the way to keep people/things separate.
I'm using React, Redux, and Socket.io. What I was hoping was that opening a URL in a second tab would do things like increase a counter of the number of users, etc. But, the state is obviously not there, so the two edged sword slays me and I need some type of other solution -- I'm using name-spacing with Socket.io.
I am no longer using socket.io name-spacing and am using the "rooms" feature native to socket.io. I actually did get it all working on my machine (able to have multiple tabs but different rooms and the room counts appropriately update etc.). However, I have not successfully got any socket features working on the hosted site yet, so I'm pretty this isn't over. (Rather new at this.) Will update post again when I know more. Thanks for the awesome answers so far.