VolatileSD / ChatServer

Chat server which allows users to authenticate, chose room and send text lines to other users in the same room. The service should be scalable in the number of connected users, allow subscription of notable events, and provide a REST interface for management and description.
3 stars 1 forks source link

Chat Client Protocol #19

Open vitorenesduarte opened 9 years ago

vitorenesduarte commented 9 years ago

We will have a problem when we have a chat client. Let's say the client writes in the socket:

:login username password

Now, if it's successful, our answer is : username, you're logged in. If not: Login invalid. Check valid username or password.

We could test in the client which one it is, but I don't think it's practical, because we would have to do the same in every user action. Besides that, if we change the server, we'll have to change the client.

So, what's the best solution for this?

vitorenesduarte commented 9 years ago

For now we are returning :ok for successful requests and :ko otherwise. It's not very pleasant for the clients who use telnet or nc.

We could send different answers for chat client and telnet client, but I hope it doesn't come to that.

How can we solve this?

vitorenesduarte commented 9 years ago

Kinda solved. Moved the answers to create, remove and login commands to Common project. Now there's only one place where we can change them and it will keep everything happily working.

Shall we move all?

vitorenesduarte commented 9 years ago

Since there's one port dedicated to the GUI client we could change all this to JSON.