(Note: I've intentionally put non adequate websocket
tag here, as it's best chance for WebSocket expert folks to know architecture of Ratchet).
I'm up for implementing HTML5 server side events, and what I need is server side solution. Since hanging Apache's one process per connection (connection pool limit, memory consumption...) is out of consideration I was hoping that Ratchet project can be of help, since it's most maintained project and they have http
server coupled along with other components.
My question is: how can I use it? Not for upgrading http
request (default usage), but for serving dynamically generated content.
What have I tried so far?
installed
Ratchet
as explained in tutorialtested WebSocket functionality - works properly
followed very basic set of instructions given on page that describes
http
server component:
/bin/http-server.php
use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
require dirname(__DIR__) . '/vendor/autoload.php';
$http = new HttpServer(new MyWebPage);
$server = IoServer::factory($http);
$server->run();
One should not be an expert to figure out that MyWebPage
class here needs to be declared in order for server to work, but how?
The Ratchet documentation does not seems to cover this.