I was wondering how to make "true" (semi) streams of data in real time using PHP.
Possible applications: chats, auctions, games, etc.
By "truth" I mean that the data is not just written somewhere and constantly polled, but actually flows for the client somehow.
By "semi" I mean that this is normal if only the flow from server to client is in real time and the messages from client to server are not.
For communication between the client and the server, I would like to stick to simple HTTP (AJAX), and not another protocol.
Streaming to a client using HTTP is possible by manually flushing the output buffer.
The question is what to connect this script to the server?
And as soon as he connected, to make the lock read, not a poll for changes.
The shared memory extension (shmop) will work, but it is not cross-platform.
Maybe memcached will work? But I'm not sure if there is a way to do read locks, so it comes down to polling again - although I'm sure memcached is pretty fast, I just don't like the idea of ββcontinuous polling.
Any ideas?
mindplay.dk
source share