@@ -55,7 +55,7 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * Add some data to the buffer. |
| 57 | 57 | * |
| 58 | - * @param $data |
|
| 58 | + * @param string $data |
|
| 59 | 59 | */ |
| 60 | 60 | public function addBuffer($data) |
| 61 | 61 | { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | private function initListeners() |
| 42 | 42 | { |
| 43 | - $this->stream->on('data', function ($data) { |
|
| 43 | + $this->stream->on('data', function($data) { |
|
| 44 | 44 | $this->processData($data); |
| 45 | 45 | }); |
| 46 | 46 | $this->stream->once('end', function() { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | $this->getHandler()->onDisconnect($this); |
| 52 | 52 | }); |
| 53 | - $this->stream->on('error', function ($data) { |
|
| 53 | + $this->stream->on('error', function($data) { |
|
| 54 | 54 | $this->error($data); |
| 55 | 55 | }); |
| 56 | 56 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $this->currentMessage = $message; |
| 93 | 93 | if ($this->currentMessage->isComplete()) { |
| 94 | 94 | // Sending the message through the woketo API. |
| 95 | - switch($this->currentMessage->getOpcode()) { |
|
| 95 | + switch ($this->currentMessage->getOpcode()) { |
|
| 96 | 96 | case Frame::OP_TEXT: |
| 97 | 97 | $this->getHandler()->onMessage($this->currentMessage->getContent(), $this); |
| 98 | 98 | break; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | } else { |
| 106 | 106 | // We wait for more data so we start a timeout. |
| 107 | - $this->timeout = $this->loop->addTimer(Connection::DEFAULT_TIMEOUT, function () { |
|
| 107 | + $this->timeout = $this->loop->addTimer(Connection::DEFAULT_TIMEOUT, function() { |
|
| 108 | 108 | $this->logger->notice('Connection to ' . $this->getIp() . ' timed out.'); |
| 109 | 109 | $this->messageProcessor->timeout($this->stream); |
| 110 | 110 | }); |
@@ -11,18 +11,18 @@ |
||
| 11 | 11 | |
| 12 | 12 | namespace Nekland\Woketo\Core; |
| 13 | 13 | |
| 14 | -use Nekland\Woketo\Exception\NoHandlerException; |
|
| 15 | -use Nekland\Woketo\Exception\WebsocketException; |
|
| 16 | -use Nekland\Woketo\Message\MessageHandlerInterface; |
|
| 17 | -use Nekland\Woketo\Rfc6455\Frame; |
|
| 18 | -use Nekland\Woketo\Rfc6455\Handshake\HandshakeInterface; |
|
| 19 | -use Nekland\Woketo\Rfc6455\Message; |
|
| 20 | -use Nekland\Woketo\Rfc6455\MessageProcessor; |
|
| 21 | -use Nekland\Woketo\Utils\SimpleLogger; |
|
| 22 | -use Psr\Log\LoggerAwareTrait; |
|
| 23 | -use Psr\Log\NullLogger; |
|
| 24 | -use React\EventLoop\LoopInterface; |
|
| 25 | -use React\EventLoop\TimerInterface; |
|
| 14 | +use Nekland\Woketo\Exception\NoHandlerException; |
|
| 15 | +use Nekland\Woketo\Exception\WebsocketException; |
|
| 16 | +use Nekland\Woketo\Message\MessageHandlerInterface; |
|
| 17 | +use Nekland\Woketo\Rfc6455\Frame; |
|
| 18 | +use Nekland\Woketo\Rfc6455\Handshake\HandshakeInterface; |
|
| 19 | +use Nekland\Woketo\Rfc6455\Message; |
|
| 20 | +use Nekland\Woketo\Rfc6455\MessageProcessor; |
|
| 21 | +use Nekland\Woketo\Utils\SimpleLogger; |
|
| 22 | +use Psr\Log\LoggerAwareTrait; |
|
| 23 | +use Psr\Log\NullLogger; |
|
| 24 | +use React\EventLoop\LoopInterface; |
|
| 25 | +use React\EventLoop\TimerInterface; |
|
| 26 | 26 | use React\Socket\ConnectionInterface; |
| 27 | 27 | |
| 28 | 28 | abstract class AbstractConnection |