Using CakePHP, I want to establish a bidirectional connection between server (CakePHP) and client (Browser) for realtime exchange of data (e.g. for a chat).
Therefore I dont want to have the page reloaded every single time I am firing a message.
In my understanding this is either working with AJAX, which is not recommended for chatting, or via a WebSocket.
However, I cannot find out how to establish such a connection. One chapter in the CakePHP documentation mentions HTTPClients which unfortunately seems not to be what I want to have.
However, I found this Socketbased Library called Ratchet: http://socketo.me/docs/flow Did someone ever tried to establish anything similar? I would not even know how to integrate this Socket into my CakePHP project.
Your question has all the answers. Either long polling or websockets. You could use ratchet or reactPHP. To include it in cakePHP you might want to use a plugin like this.