I would like to implement a very small and simple group chat into my website without using any 3rd party libraries or anything.
Therefore I thought of using jQuery Ajax and Javascript's setInterval function.
On page load I am going to have a div, with all the chat messages inside, that have been posted so far + a hidden input with the max(id) of the chat-table in the database. Then I would start setInterval with an ajax request to the database every second, which returns all new messages (id > the one in the hidden input), adds them to the DOM and updates the hidden input to the new max(id).
Furthermore I thought of deleting all messages older than 48 hours from the database, to keep the chat-table very small.
Do you have any concerns about this? Will it significantly impair the performance of the site?
The site may have up to 100 concurrent users at a time, but only half of them will have access to the chat.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)