Skip to main content

Timeline for answer to How to create websockets server in PHP by Basj

Current License: CC BY-SA 4.0

Post Revisions

4 events
when toggle format what by license comment
Jan 20, 2022 at 8:10 comment added Basj @evilReiko No no this is not long polling at all; the while / sleep(1) is just an example to make the server send example messages every second to the client, just as a demo of WebSocket. In real applications, you don't need at all this sleep(1) on server code!
Jan 19, 2022 at 23:43 comment added LovelyHanibal That is a good example. It nicely and simply show how to listen to connection and send data to webbrowser. I wish there will also add example how to receive data from webrowser to server. When I use socket_read after handsahek data seem seem to be not ASCII.
Dec 26, 2021 at 8:51 comment added evilReiko This is good as an introduction of how websockets could work with PHP, but implementation might not be really worth it in real world, as it uses while(true) .. sleep(1) (which is called "long polling", which is not good). On the other hand, Ratchet uses in its core ZeroMQ, which handles it properly.
Jan 30, 2021 at 23:19 history answered Basj CC BY-SA 4.0