GithubHelp home page GithubHelp logo

koa2- remove about ghchat HOT 4 OPEN

ciaoamigo avatar ciaoamigo commented on May 18, 2024
koa2- remove

from ghchat.

Comments (4)

aermin avatar aermin commented on May 18, 2024

Hi, I'm asking for your code.
I saw that you use koa2 is a great framework, but it is only used in the authentication/login phase.
To improve the performance and make the code more homogeneous, I would use only socket.io
So it's better to remove koa2 and use socket.io also for registration and login.
What do you think about it?

Hi, @ciaoamigo . I think using socket.io in authentication/login/register worries me about the performance because socket.io will take long connection. And in these scenarios, the long connection is not necessary but increasing the server pressure. So I decided to use HTTP instead of socket.io in these scenarios and start the long connection by socket.io after the user logs in. It is just my personal opinion, welcome to discuss. 😃

from ghchat.

ciaoamigo avatar ciaoamigo commented on May 18, 2024

Sure. But just connect via socket only when:

  1. When I log in
  2. When I register.
    This makes the application homogeneous with the following advantages:
  • all connections to the backend come only via socket;
  • easier to create a sdk-client to use with both react.js and react-native
  • simpler maintenance as less technology is used;
    etc.

from ghchat.

aermin avatar aermin commented on May 18, 2024

Sure. But just connect via socket only when:

  1. When I log in
  2. When I register.
    This makes the application homogeneous with the following advantages:
  • all connections to the backend come only via socket;
  • easier to create a sdk-client to use with both react.js and react-native
  • simpler maintenance as less technology is used;
    etc.

Good idea.👍
I got it. Init to connect socket and emit request when the user clicks the button to log in or register. I will refactor it in the future. Thank you very much.

If you are interested in it, welcome to develop this project together. 😄

from ghchat.

aermin avatar aermin commented on May 18, 2024

Hi, @ciaoamigo. I am going to refactor the part where we talk about. But I find that If I use socket.io instead of the HTTP request When the user clicks the register button but fails, at this time the server has to keep connect to client(long connect, needless performance loss) because the user maybe tries against after a period of time. What do you think about?

from ghchat.

Related Issues (15)

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.