4 ms·
I have to create some push based (websockets or similar) web service that's event driven (events on the stock market). The prototype has been written in PHP, bu
by AlexanderDhoore 13y ago
I have to create some push based (websockets or similar) web service that's event driven (events on the stock market). The prototype has been written in PHP, but doesn't do very much. I'm STRONGLY considering moving to nodejs.
We now use Composer for packages, an automatic classloader, an application framework and a database abstraction. But even with all this stuff, PHP is still an incredible pain.
PHP might be good at the situation where: on every request, you start a new script, that builds a webpage and sends it to the client. But once you try to make it do something else... Frustration awaits.
- meritt 13y agoYour worldview ( Your last statement, that you think PHP is only suitable for a single request in a fcgi environment.) of PHP's capabilities are the pain point here. What difficulties are you encountering trying to do basic pub/sub? Application developers have solved those exact same issues for decades now. Nodejs didn't invent "event-based programming".
- deleted 13y ago[deleted]
- themstheones 13y agoTrue, PHP is a great scripting language.
- AlexanderDhoore 13y agoEvent driven programming seems tacked on to php. I don't know if I want to run php as a daemon and then do some hackery to get IPC. It's not made for that...
- wwweston 13y agoI've written a lot of PHP, and while I can think of a number of ways you might use PHP to provide the backend for websocket-like communication (writing a long-running server, using multipart responses, adaptive polling), it seems pretty fair to me to say this isn't the place where PHP is strongest out of the box. Particularly compared to nodejs. If you know of a PHP runtime-host, library, or even just a development approach that makes supporting it as easy as nodejs, though, I'm all ears.
- meritt 13y agohttp://reactphp.org/ http://reactphp.org/ ( more specifically http://socketo.me/ http://socketo.me/ ) work very well for actually implementing websockets. It's fast and incredibly easy. Igor (https://github.com/igorw https://github.com/igorw) is a really talented guy.