I'm going to create a live chat system for my website, but I'm not sure how to go about it. My original plan was to have an AJAX request to get the chat log every X seconds, and that's what it seems a lot of tutorials have done.
However, I'm worried that by doing this, I might use up my server's resources unnecessarily, or very quickly. I want my chat to be quite accurate, so I guess my question is, what's the most appropriate time in milliseconds I should wait between each ping to not use up my server's resources while keeping my chat log accurate?
If you want something powerfull, try to look into websockets. You can find some intuitive libraries like socket.io.
Otherwise it's ok to use ajax on a setTimeout and do some research about ajax polling wich is the best technology to use in that case.