html5 websockets, not possible ever for php?

61 views
Skip to first unread message

Rich

unread,
Dec 30, 2011, 12:04:21 PM12/30/11
to highload-php-en
Hello,

Have used FPM for some time and am very happy with it.

I am trying to confirm my suspicions that PHP will not be able to
handle the html5 websocket scenario -- 10s of thousands of open
sockets in real-time page "apps" that are somewhat more interactive
than the page from the server round-trip. Could PHP ever do SEDA
like the other languages? Since everything is done from scratch on
every request, I'm not sure how this would be possible. Wouldn't
every open websocket consume a single PHP process, unless PHP were
fronted by something else that would handle all the open sockets and
queues.

Thanks for any thoughts or info about this!

Rich

Antony Dovgal

unread,
Dec 30, 2011, 3:15:56 PM12/30/11
to highloa...@googlegroups.com

Browsers usually do not connect directly to PHP processes, they interact with a web-servers
that may or may not forward requests to PHP processes.

But if you for whatever reason would like to serve the requests directly,
you can always write a daemon in PHP using libevent extension.

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

Rich

unread,
Jan 5, 2012, 11:09:27 AM1/5/12
to highload-php-en
Thanks! Looking into libevent now..

Ideally nginx would handle the nio layer, but I've only seen it used
as a proxypass to the backend which handles the nio layer. I don't
know how programmable nginx is either.

0MQ has a PHP binding..
http://www.zeromq.org/bindings:php

There's also nanoserv:
http://nanoserv.si.kz/

Will read up on Nginx more, ideally that would handle it, but if I
have to make a PHP daemon that's ok I guess.

So much for escaping PHP ...

Rich
Reply all
Reply to author
Forward
0 new messages