Skip to content

Instantly share code, notes, and snippets.

@markri
Created June 17, 2014 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markri/5df031a5db6a25dd64e8 to your computer and use it in GitHub Desktop.
Save markri/5df031a5db6a25dd64e8 to your computer and use it in GitHub Desktop.
<?php
require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
require_once __DIR__.'/../app/AppCache.php';
use Symfony\Component\HttpFoundation\Request;
// Boot Kernel
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$kernel->boot();
$cacheKernel = new AppCache($kernel);
$context = new ZMQContext(1);
// Socket to talk to clients
$responder = new ZMQSocket($context, ZMQ::SOCKET_REP);
$responder->bind("tcp://*:5556");
// Start application thread
while (true) {
// Wait for next request from client
$request = unserialize($responder->recv());
$response = $cacheKernel->handle($request);
// Send reply back to client
$responder->send(serialize($response));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment