0

HI ,

I am creating a social media site, but getting stumped on updating the status comment boxes. Currently, when a user post a comment to a status it updates in REAL-TIME (ajax) on their page, however, it does not on the clients side. How can I build a comment box to read in REAL-TIME?

I am looking into using either node.js, socket.io or websockets, but I am not sure how to get started. NEW to using that development.
I am currently using just JQUERY / AJAX, but I am sure there is another way to show new comments to both client / user without the latency or memory getting full.

Thanks in advance for some help.

Edited by programmer12

3
Contributors
4
Replies
14
Views
1 Year
Discussion Span
Last Post by ryantroop
1

Are you talking about a "push"? Ajax won't do anything for this unless you ask it to poll the server repeatedly - not recommended. There are things called comet servers. PHP with ratchet (http://socketo.me/demo) or socket.io with nodejs may suit you.

0

Yes, I agree. I will rewrite the scripts to poll the server instead. I was hoping for a tutorial or demo of status updates, but I assume it's similar to the chat funtions?

0

For modern browsers you can look into making ajs socket but you will need to write a custom socket server based on the spec (rfc).

0

For some reason I cant edit, so... A JavaScript socket*

To expand, you would still use polling for older browsers and use the socket for newer ones.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.