I'm attempting to make a very simple 2-person chatroom for my Django site. I'm learning AJAX to do this. I need parts of the web page to update without user interaction:
- When User 1 sends a message, it should appear on User 2's screen
- When User 1 logs off, his status should change to "offline" on User 2's screen
What is the simplest way to implement this? Is it just to use JavaScript to poll the server at regular intervals? If so, what is the best practice for doing this? I found a few solutions about using setInterval or setTimeout, but wasn't sure if this was the best way.
(I've read about reverse AJAX, but from what I've read this is more complex to implement. I don't need my solution to be fast or scalable; I just need it to work.)