Chat Part Implementation

Chat&IM message

This week, I mainly completed functions of Chat&Instant message sending and receiving. And now, Android client can send and receive both chat and instant message among other devices.

As for the chatting part, one can send a message to everyone in his chat room. When the send buton is clicked, a queueMessage is called to queue a message, and then postQueue is called to post message queue to server one by one. And at current, there’s no encryption in communication.

As for the IM part, one can send a message to someone in his chat room privately. As for choosing the recepiant, I changed the orginal design a little. Instead of putting the “all” button at the left of input box, I put a small icon at the top of ChatListFragment, and when user clicks it, a user list is shown. The first row is “Everyone” indicating public message, otherwise indicating private instant message.

When a chat message reaches CouchDB, the longpollingChat returns the first and last id of new messages. Then a getMessage is called to retrieve message contents from server, then message is shown to Android client. When an instant message reaches CouchDB, the longpollingIM returns the message document, including message receiver, sender, and message content. Then it is directly shown to Android client.

Here shows the result of chat message.

12.0

Here shows the recipient list after click “to: Everyone”:

3.0

Here shows the instant message:

44.0

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s