How would you make an instant messenger program for a websites userbase?

10,696

Solution 1

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.

Solution 2

coding SOAP (Simple Object Access Protocol) using JAVA (and XML) or any other language is much easier and faster.

Solution 3

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.

Share:
10,696
JasonDavis
Author by

JasonDavis

PHP/MySQL is my flavor of choice however more recently JavaScript is really becoming something I enjoy developing with! Writing code since 2000' Currently working heavily with SugarCRM + Launching my Web Dev company ApolloWebStudio.com "Premature optimization is not the root of all evil, lack of proper planning is the root of all evil." Twitter: @JasonDavisFL Work: Apollo Web Studio - https://www.apollowebstudio.com Some of my Web Dev skills, self rated... +------------+--------+------+--------------+ | Skill | Expert | Good | Intermediate | +------------+--------+------+--------------+ | PHP | X | | | +------------+--------+------+--------------+ | MySQL | X | | | +------------+--------+------+--------------+ | Javascript | X | | +------------+--------+------+--------------+ | jQuery | X | | +------------+--------+------+--------------+ | CSS+CSS3 | X | | +------------+--------+------+--------------+ | HTML+HTML5 | X | | | +------------+--------+------+--------------+ | Photoshop | | X | | +------------+--------+------+--------------+ | Web Dev | X | | | +------------+--------+------+--------------+ | SugarCRM | X | | | +------------+--------+------+--------------+ | Magento | | X | | +------------+--------+------+--------------+ | WordPress | X | | | +------------+--------+------+--------------+ | SEO | X | | | +------------+--------+------+--------------+ | Marketing | X | | | +------------+--------+------+--------------+ |Social Media| X | | | +------------+--------+------+--------------+

Updated on June 26, 2022

Comments

  • JasonDavis
    JasonDavis about 2 years

    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

  • Unknown
    Unknown almost 15 years
    Agh Mark, you messed up my 5 minute edit-friendly position time.