From 01e1d159e830b2bc7f4f243c845bdddb13d23755 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Thu, 25 Feb 2016 19:26:42 -0500 Subject: [PATCH] Naming conventions --- src/Ratchet/WebSocket/ConnContext.php | 6 +++--- src/Ratchet/WebSocket/WsServer.php | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Ratchet/WebSocket/ConnContext.php b/src/Ratchet/WebSocket/ConnContext.php index 7aa6322..2eba782 100644 --- a/src/Ratchet/WebSocket/ConnContext.php +++ b/src/Ratchet/WebSocket/ConnContext.php @@ -11,10 +11,10 @@ class ConnContext { /** * @var \Ratchet\RFC6455\Messaging\MessageBuffer; */ - public $streamer; + public $buffer; - public function __construct(WsConnection $conn, MessageBuffer $streamer) { + public function __construct(WsConnection $conn, MessageBuffer $buffer) { $this->connection = $conn; - $this->streamer = $streamer; + $this->buffer = $buffer; } } diff --git a/src/Ratchet/WebSocket/WsServer.php b/src/Ratchet/WebSocket/WsServer.php index 57f1ebe..0238e23 100644 --- a/src/Ratchet/WebSocket/WsServer.php +++ b/src/Ratchet/WebSocket/WsServer.php @@ -127,8 +127,7 @@ class WsServer implements HttpServerInterface { return; } - $context = $this->connections[$from]; - $context->streamer->onData($msg); + $this->connections[$from]->buffer->onData($msg); } /** @@ -139,7 +138,7 @@ class WsServer implements HttpServerInterface { $context = $this->connections[$conn]; $this->connections->detach($conn); - $this->delegate->onClose($context->conn); + $this->delegate->onClose($context->connection); } } @@ -148,8 +147,7 @@ class WsServer implements HttpServerInterface { */ public function onError(ConnectionInterface $conn, \Exception $e) { if ($this->connections->contains($conn)) { - $context = $this->connections[$conn]; - $this->delegate->onError($context->connection, $e); + $this->delegate->onError($this->connections[$from]->connection, $e); } else { $conn->close(); } @@ -194,8 +192,7 @@ class WsServer implements HttpServerInterface { $lastPing = new Frame(uniqid(), true, Frame::OP_PING); foreach ($this->connections as $key => $conn) { - $context = $this->connections[$conn]; - $wsConn = $context->connection; + $wsConn = $this->connections[$from]->connection; $wsConn->send($lastPing); $pingedConnections->attach($wsConn);