Code Monkey home page Code Monkey logo

Comments (2)

leslie-alldridge avatar leslie-alldridge commented on July 19, 2024

@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

from chatcord.

William94wps avatar William94wps commented on July 19, 2024

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

from chatcord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.