PHP WebSocket - flush() Support

Context:

  • I want to develop a real-time web app that uses WebSocket.

  • One app will be running on main PC (let’s call it server) - it will start a websocket listener in PHP.

  • Other “client” app will be running on other PCs in the same network, and will connect to the main PC via javascript’s WebSocket() API. After the connection is established, messages can be exchanged in both directions in real-time.

Issue:

  • For WebSocket to work, PHP script needs to use flush() and ob_flush() commands in order to send messages to the connected client.

  • ExeOutput does not support the above mentioned commands, and so waits forever for the PHP script to complete.

I read somewhere that flush() doesn’t work because Exeoutput waits for the PHP script to fully finish - can’t we somehow change this behavior so that it pipes the output of PHP script to the CEF in real-time?

It would be great if you could find a solution to this issue, and would be really be a huge help for many such use-cases (there are already some topics discussing this issue).

1 Like

This functionality is limited by the CEF internal protocol handling. But we have made some investigation regarding flush() for our future server apps.