Jack Billy Jack Billy - 1 year ago 70
HTML Question

How to get realtime updates?

I was chatting frequently in Facebook and as I love to code more and more so I tried to create a Chat Script! Here it is :::

You try it out. But it is just a beta version so there are some bugs in it. And one of the biggest bug is that it requires a good internet speed to get real time updates. But when I push my net's speed to it's maximum and then chat with one of my friends in Facebook, it work in real time! I was wondering how did they do that? Can anyone explain me how they achieved this. Currently I'm sending Ajax requests in number intervals to get real time update. So please help me out by explaining or giving a link that how did Facebook achieved real time Chats without using much of the Internet speed?

Answer Source

To do real time communication you need a proper connection.

You can use WebSockets to give you a real Browser - Server TCP connection.

The alternative to WebSockets would be a flash bridge (which uses websockets in flash) or COMET techniques.

My personal recommendation is a WebSocket abstraction like socket.io.

Socket.io builds on node.js which Serverside Javascript. It excels at evented asynchronous real time communication.

If your going down the node route you might aswell pick up now to make your life easy. It has a screencast about making a chat server in 12 lines.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download