0

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

  1. Server class need to configure the sockets.
  2. 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.

3 Answers 3

1

Your server and client will have group property

So client will send a message lets call it as Message object

class MessageObject {

 String message;

 String group;
}

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.

Sign up to request clarification or add additional context in comments.

Comments

1

The chat sample of atmosphere should give you enough to get you started.

Comments

1

This ppt could help you to start

I recommend you check a book about distributed systems or network communication

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.