ajax - Communication between browsers via PHP
I am building a simple ajax chat client for a school project and have thought of a way to implement this, but it seems IMO to be very cumbersome approach:
1) User A sends message which is accepted by a server-side PHP script and saved to database 2) The browser of User B periodically launches a server side PHP script to check if there are any messages in the database for User B. PHP script finds messages from User A and returns them.
Is this the right approach? Can communication between these two users be achieved without a database?
(This is my first web-application...if I was making this without browsers + HTTP, I would just make a Java program with persistent class that listened on TCP sockets, and forwarded messages to the appropriate address)