The problem of building chat rooms in socket.io,koa2.

ask a question about the server structure.
the current plan is for chat rooms to have functions such as login, public chat, custom groups, friends, private chat, and so on.
every function must be a functional module. Here comes the problem:

should I write each function as a separate koa app, listening on its own port, or should I listen on only one port in a koa app and treat each function as a functional module of the app?

at present, I personally feel that if you are in a single koa app, you will take up less link resources, but this app will deal with more things.
if separated, it takes up a lot more link resources, but there is less pressure on each app.

currently I have only one server. Although I am only writing a demo, I still want to ask someone with experience to analyze what problems should be paid attention to. Thank you.

Apr.05,2021

must be a port and then distribute it. Because performance does not depend on how many resources you take up per app, but on the total amount of resources taken up.


one port is good. Even if it is made into multiple ports, it is better to keep socket.io on one port


than to have more than one common

.
Menu