0

I need to include chat, in my application. People sign in the chat and create their user and chat to other users. However it needs to be like facebook chat or pingchat where you add friends you want to talk to.

Can anyone give me pointers to what i need to do? I've heard about xmpp servers but not sure if that is the right thing for my app. Any help would be much appreciated

Thanks

Dangermouse
  • 95
  • 1
  • 6

1 Answers1

3

Is your app going to create new users, and add them in the chat list, or going to use existing users (like Gtalk, Y! Messenger etc) on existing protocols (like IRC, XMPP etc)...?

If you are going to implement your own chat system, where your users are registering in your website, then you are going to do these things:

  1. Setup your website
  2. Create a protocol (that's, how you pass messages)
  3. Write and implement an API (in PHP, ASP etc)
  4. Connect that API with your iPhone app.

How it works?

You keep a table of chat messages. The table include:

  1. Chat_From
  2. Chat_To
  3. Chat_Message
  4. Timestamp

All what you do is, when you start a Chat session from Alice to Bob, you just enter them in the table. Next, you fetch the row from the Web Server to your App, by calling your PHP file (say, http://mychatserver.com/getChat.php) based on the condition SELECT CHAT_MESSAGE FROM CHAT_TABLE WHERE CHAT_FROM="ALICE" AND CHAT_TO="BOB";. This message is displayed in your App.

This process should be performed repeatedly, with an interval of, say 1 sec.

I hope you got this idea.

Vishnu Haridas
  • 7,355
  • 3
  • 28
  • 43
  • sorry i should have been more clear it's going to use existing users like msn, so they use their e-mail address and their friends on the app are the same friends on their msn friend list. – Dangermouse Jul 28 '11 at 17:15
  • Oh, then you have to refer XMPP protocols. I think this page in StackOverflow will help you: http://stackoverflow.com/questions/3092534/good-tutorials-on-xmpp – Vishnu Haridas Jul 28 '11 at 17:17