Reputation: 48973
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
Upvotes: 3
Views: 10726
Reputation: 51
coding SOAP (Simple Object Access Protocol) using JAVA (and XML) or any other language is much easier and faster.
Upvotes: 5
Reputation: 46821
I recommend that you use XMPP, the core protocol for Jabber.
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.
Upvotes: 4
Reputation: 35117
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.
Upvotes: 1