How does Jabber based Chat client works ??

oracle

New Member
Messages
430
Reaction score
0
Points
0
Hello Everyone,

I have made a browser based chat client using Ajax and MySQL. I will in short explain how is it done:

Suppose we have user A and user B. Now browser of both A and B keep pinging my server for new message. If a new message is found in the database tables, it is taken back and displayed.

But my question is, that in a scalable issue, this system will fail. Mainly because of continuous ajax request which client browser will make every n seconds (1-5 seconds).

I tried and looked at how Gmail and Facebook browser based browsers work. I dont see any continous request for new messages from the client to server thr. All i see is, if user A sends a message, it is sent to server via ajax and if it is intended for user B, it is sent to user B. (without waiting for any message request by user B)

Now i don't understand how a one sided connection is established between server and user B where server is sending a data to user B without user B requesting for it.

Any suggestions, web pointers, documents etc will be really helpful.

Imoracle
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
I don't think it's possible not to use a continious request, and it will certainly be the easyest...
 

oracle

New Member
Messages
430
Reaction score
0
Points
0
But try analysing the gmail integrated chat or facebook chat for instance

They dont send a packet untill you type in something, and if you are patient enough try analysing this with a friend on the other side. Start chatting and you see packets going.

Stop chatting no packet goes. And suddenly when one person types in a message, the other user recieves it

How come??
 
Top