I am creating a login server for my client for a server application.
Basically there are 5 servers, and all of these servers are connected to the same login server.
A client can connect to any of these 5 servers, but it must authenticate with a username and password. Authentication should be performed on the login server, and the login server should return a response to the actual server, which should return a response to the client.
So like this:
Client β Server β Login Server β Server β Client (response code)
Now I use Netty and this is NIO, it is not a stream to the client. Now, in order to authenticate using NIO, we have to wait for a response from the login server, and this may take some time and delay other clients who want to log in, in fact, you canβt just wait for a response from NIO, so I I thought about how I can make it work. My idea started the request in another thread and had an event with the onResponse(String key, int responseCode) method onResponse(String key, int responseCode) , and then put the client channel on the map with the generated key so that we can find out who the answer belongs to. Therefore, when we authenticate, we send the key and user data.
But I feel that this is a bad way, and there is a more efficient method for this. Any ideas?
source share