I have to make a web application for chat which will work as skype, like 1 to 1 chat as well as group chat.
Last some days i am researching on google and i come to know following things.
For making speed better, i must use sockets. Database must in involved for storing the history of chat.
Last 1 year, i am working on java but unfortunately never worked on socket connection.
There are some online code available, even i tried to understand it as well but its all gone above my head.
But couple of things i come to know as follows
- Server class need to configure the sockets.
- client class need to send the message through the sockets.
My question is how i will come to know that a specific message is send to specific group or person…??
As only 1 socket is connecting to all group, a particular message will go to all.
I do not need a example, i just need to make a algorithm right so that i can start work on.
Your server and client will have group property
So client will send a message lets call it as Message object
Your server will have keep a note of all client and depending upon group it will store them say in a map.
Whenever a new message comes to the server, it will check the group of the message and depending upon it, from the map it will get a list of clients and will write the message on to there stream.