Use $this in closure, fixed ref to handleData

This commit is contained in:
Chris Boden 2017-03-10 09:22:43 -05:00
parent 8d8d574199
commit b00da833ce

View File

@ -98,15 +98,14 @@ class IoServer {
$this->app->onOpen($conn->decor);
$that = $this;
$conn->on('data', function ($data) use ($conn) {
$that->handleData($data, $conn);
$this->handleData($data, $conn);
});
$conn->on('close', function () use ($conn, $that) {
$that->handleEnd($conn);
$conn->on('close', function () use ($conn) {
$this->handleEnd($conn);
});
$conn->on('error', function (\Exception $e) use ($conn, $that) {
$that->handleError($e, $conn);
$conn->on('error', function (\Exception $e) use ($conn) {
$this->handleError($e, $conn);
});
}