I am in a process of making an instant messenger something similar to gtalk.
Till now i have registered the user and using session info i know if the user is logged or not. When he is logged on i update the database table field online =1 and otherwise it is 0 .(1 represents (s)he is online). It's fine till here... But next I have to check after 2 seconds if the user is still logged on or has logged out.
Suppose he is currently logged then the db field says 1, now he logs out but then also the db field says 1 although it should say 0 (as user logged out). SAo my problem is how to know if the user is still logged on or not.
If there something like pinging that can be done ... it could be helpful but wiill take alot of resources...
suggestion/comments/links welcome
Instant Messenger
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
I would definitely use a library for this.
Get familiar with the XMPP spec. There are a bunch of libraries, clients and servers for it already, and it's just plain awesome. Don't worry - there's still a mountain of work for you to do.
Also don't forget that HTTP is stateless, whereas chat/presence is stateful. You'll need the translation to happen somewhere, hopefully in a pre-built library!
Get familiar with the XMPP spec. There are a bunch of libraries, clients and servers for it already, and it's just plain awesome. Don't worry - there's still a mountain of work for you to do.
Also don't forget that HTTP is stateless, whereas chat/presence is stateful. You'll need the translation to happen somewhere, hopefully in a pre-built library!