Conversation
| try { | ||
| $callback($request, $response); | ||
| } catch (\Exception $ex) { | ||
| $this->emit('error', array()); |
| $server->on('request', $this->expectCallableOnce()); | ||
| $countCalled = 0; | ||
|
|
||
| $callback = function ($request, $response) use (&$countCalled) { |
clue approved these changes Feb 9, 2017
|
|
||
| For each incoming connection, it emits a `request` event with the respective | ||
| For each incoming connection, it executes the callback function with the respective | ||
| [`Request`](#request) and [`Response`](#response) objects: |
|
|
||
| The `Server` class is responsible for handling incoming connections and then | ||
| emit a `request` event for each incoming HTTP request. | ||
| execute the execute the callback function passed to the constructor. |
| as HTTP. | ||
|
|
||
| For each incoming connection, it executes the callback function with the | ||
| respective [`Request`](#request) and [`Response`](#response) objects: |
| $socket = new React\Socket\Server(8080, $loop); | ||
|
|
||
| $http = new React\Http\Server($socket); | ||
| $http = new React\Http\Server($socket, function (Request $request, Response $response) { |
| public function __construct(SocketServerInterface $io, $callback) | ||
| { | ||
| if (!is_callable($callback)) { | ||
| throw new InvalidArgumentException(); |
clue approved these changes Mar 15, 2017
jsor approved these changes Mar 16, 2017