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

koa2- remove #11

Open
ciaoamigo opened this issue Mar 13, 2019 · 4 comments
Open

koa2- remove #11

ciaoamigo opened this issue Mar 13, 2019 · 4 comments

Comments

@ciaoamigo
Copy link

ciaoamigo commented Mar 13, 2019

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?

@aermin
Copy link
Owner

aermin commented Mar 13, 2019

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. 😃

@ciaoamigo
Copy link
Author

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.

@aermin
Copy link
Owner

aermin commented Mar 14, 2019

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. 😄

@aermin
Copy link
Owner

aermin commented Mar 31, 2019

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?

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

2 participants