Gmail Chat Implementation
- 9 Comment

Today i implemented gmail chat window , not an ajax chat with a chat server, but its client side implementation.
Here you can see the demo: http://www.sajithmr.com/gtalk/
Take this link in a new tab or window, and take any other website without closing it.
After 3 seconds , (Consider it as a new chat message arrived situation) you can see the google chat notification sound , and title changing. (I didn’t get the actual gtalk notification sound, so i used windows notify.wav file )
You know google (gmail) implemented its sound notification is via swf object. Here me too done the same.
I wrote two function to check whether the browser is in focus or not.
Here is the functions:
function lostFocus()
{
document.title = 'Sajith M.R Says...';
state = 'nonfocus';
played = 0 ;
changeColorRed();
alterTitle();
}
function gotFocus()
{
document.title = 'Gmail Inbox(1)';
state = 'focus';
played = 0 ;
}
The alterTitle() function calls in 3 seconds setTimeOut manner.
function alterTitle()
{
if(state =='nonfocus')
{
if ( document.title == 'Gmail Inbox(1)')
{
if(played == 0)
{
soundManager.play('notify');
played = 1;
}
document.title = 'Sajith M.R Says...';
}
else
document.title = 'Gmail Inbox(1)';
setTimeout("alterTitle()",3000);
}
}
The soundmanager.js file handles the swf flash object and sound triggering.
<script type=”text/javascript” src=”script/soundmanager.js”></script>
These three simple scripts together created this demo: http://www.sajithmr.com/gtalk/
If you want the whole source code , mail me: admin@sajithmr.com
Comment Please …
Regards
Sajith.M.R
http://www.sajith.name
- Gmail Architecture
- Upload Files Like Gmail
- Gmail Chat Implementation
9 Comments on this post
Trackbacks
-
sanils said:
This is cool implementation in the client side.
May 7th, 2008 at 7:27 pm -
vikas said:
Hi,
I looking for hints to implement a gmail like chat, and reading your post has been very informative. Thanks a lot for such a good break of the functionality. It would be very kind of you, if you can send the source code for the gtalk demo you have put on your website.Thanks a lot.
Regards,
vikaJune 16th, 2008 at 6:16 pm -
Sajith M.R said:
Hey Vikas,
Here is the full source code of client side implementation .
(Not the sever side)http://www.sajithmr.com/downloads/gtalk.zip
Regards
SajithJune 16th, 2008 at 8:02 pm -
Leonardo Parada said:
Hello:
What need your code for work like an real chat?…AJAX?
I want put on GMAIL CHAT on my blog…I will thank your help please.
Thanks and Congratulations.July 20th, 2008 at 10:26 pm -
Sajith M.R said:
@Leonardo Parada
Hello, i dont have gmail full chat code. If you want to put a gmail chat on your blog, you can use google widget for that purpose, no need to code yourself. Gtalk widget for any blog is currently available.
Regards
SajithJuly 20th, 2008 at 11:14 pm -
Mohamed Hanifa said:
Hi
How gmail chat get value from another client or user side windows value .Thats what icant under stand..and how its working . you were discuss about only title bar
message and focus changing.
Colud u explain breifly please..
Thanks & Regards
R.Mohamed anifa
July 30th, 2008 at 2:36 pm -
Raja said:
Hi,
good work.
Do u have facebook like chat source
Plz if u hav send me
thanks.September 29th, 2008 at 12:12 pm -
M.V.Chowdary said:
Hai,
I have seen the site and I am curious to know the program regarding Gmail Chat Implementation
will u send it to the above mentioned e-mail id
October 3rd, 2008 at 12:20 pm -
sagay said:
hey,
its very cool… Is there any script to find out the invisible chat persons in gmail ?… thanks in advanceNovember 13th, 2008 at 1:35 pm




