views:

318

answers:

2

I have a social network site similar in design to a myspace/facebook type community, I am using php/mysql on a LAMP setup.
I have always wanted to possibly have my own instant messenger that would go on a user's PC similar to AIM that would work

with my site, meanning a buddylist in the program would consist of users on my site and also to show a users image next to

the name and a link to there profile on my site.

Now I know this is possible but what would make me not want to do it is the server resources it would take. So I am asking,

if you were to do this, how would you go about it?

What language would you make the .exe program in?

Is there someway to make a user connect to another user so that each message between them is not hitting my mysql DB?

Any tips/advice/suggestions welcome

+1  A: 

I recommend that you use XMPP, the core protocol for Jabber.

http://xmpp.org/

It is a protocol that many websites use such as Google Talk.

You will need a database if you want to keep logs obviously. If it is purely real-time, then you may not need to store messages through the database.

If you simply want an ajax chat feature on your website, you should just search online as there are a ton of them. If you simply want an all purpose chat server, just use a Jabber or IRC.

Unknown
Agh Mark, you messed up my 5 minute edit-friendly position time.
Unknown
Bwahaha!.... c_c
Spencer Ruport
+1  A: 

Peer to peer chats have the same pitfalls as any sort of p2p system and that is that pretty much everyone is sitting behind a hardware firewall. Practically none of them know how to change their firewall rules and even less would anyway.

You don't have to make a chat server hit your DB though. The simplest chat protocol would really be nothing more than a proxy of sorts. Client A connects to server, client B connects to server, message from client A is forwarded to client B. Really fast, really simple, can handle a lot of clients (We're talking thousands here.). I would recommend you implement a limited message cache (say 5 to 10 messages) because few things confuse two people chatting as random messages getting dropped. Cache a few of the messages, demand ACK signals from the clients for every message... etc. etc. etc.

Spencer Ruport