Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chatroom issue #7

Open
saksham7778 opened this issue May 9, 2020 · 2 comments
Open

Chatroom issue #7

saksham7778 opened this issue May 9, 2020 · 2 comments

Comments

@saksham7778
Copy link

people with same name should not be allowed to enter the same chatroom can you tell me how to implement it ?

@leslie-alldridge
Copy link

@saksham7778 I've implemented this over on my repository here

Please take note of changes made to index.html, js/login.js, server.js

Long story short, it uses the global object Brad created to do the following:

  1. User requests to login
  2. Check if username exists in global state object
  3. If exists, send user back to home page and never proceed with any further socket stuff (e.g. joining a room...)
  4. If user is unique, carry on with Brad's normal socket flow so you can chat etc.

Pretty simple really, just need to apply some lateral thinking and problem solving skills. Anyone can copy paste code, but to take your learning to the next level I suggest not copying what I've done and create your own solution.

Cheers

@William94wps
Copy link

What would the code look like to send messages to a specific user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants