Websockets For PHP – Ratchet
A common PHP-powered website is expected to run a script on the server, its content being rendered as HTML, the output is displayed and connection is closed
Using Ratchet, a WebSockets library for PHP, the connection stays open and both the client + server can push data to each other which is perfect for live-apps.
It consists of multiple components including:
- IoServer (the core to handle the events)
- WsServer (for communicating with W3C WebSocket API)
- SessionProvider (for handling the sessions)
- WampServer (provides the RPC and PubSub patterns)
- FlashPolicy (Flash fallback for unsupported browsers)
- IpBlackList (prevent any IPs from opening connections)
Ratchet is very well-documented and a nice chat demo exists which show its capabilities.