diff --git a/src/Group/ConnectionGroup.php b/src/Group/ConnectionGroup.php index b4ccc10..fc3f841 100644 --- a/src/Group/ConnectionGroup.php +++ b/src/Group/ConnectionGroup.php @@ -46,11 +46,19 @@ class ConnectionGroup implements EventEmitterInterface, IteratorAggregate, Count return count($this->connections); } + /** + * + * @return \Traversable + */ public function getIterator(): Traversable { return new ArrayIterator($this->connections); } + /** + * + * @return WebSocketInterface[] + */ public function getAll(): array { return $this->connections; @@ -70,6 +78,10 @@ class ConnectionGroup implements EventEmitterInterface, IteratorAggregate, Count } } + /** + * + * @return void + */ public function closeAll(string $reason, int $code=1001) { foreach ($this->connections as $connection) { diff --git a/src/WebSocketMiddleware.php b/src/WebSocketMiddleware.php index 3d767f2..4d8d35e 100644 --- a/src/WebSocketMiddleware.php +++ b/src/WebSocketMiddleware.php @@ -64,7 +64,8 @@ class WebSocketMiddleware implements EventEmitterInterface $this->emit(self::EVENT_CONNECTION, [ $websocket ]); //}); - // TODO would it be possible or rather useful for the 'connection' event to set additional response headers to be sent here? + // TODO would it be possible for the 'connection' event to set additional response headers to be sent here? + // For example, to send back Sec-WebSocket-Protocol header. return new Response( Response::STATUS_SWITCHING_PROTOCOLS, array( diff --git a/src/WebSocketProtocol.php b/src/WebSocketProtocol.php index a1c9ca5..0e1c97c 100644 --- a/src/WebSocketProtocol.php +++ b/src/WebSocketProtocol.php @@ -111,7 +111,7 @@ class WebSocketProtocol * payload (string) - the payload * * @param string $frame The frame data to decode - * @return array The decoded frame + * @return array The decoded frame */ public function decode(string $frame): array {