From bb0896ab124a1cef648e16dd37ff09a26c648d7a Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sat, 20 Jul 2013 12:38:23 -0400 Subject: [PATCH] [WebSocket] Only select one sub-protocol, fixes #103 --- WsServer.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/WsServer.php b/WsServer.php index 460e328..9337934 100644 --- a/WsServer.php +++ b/WsServer.php @@ -199,19 +199,15 @@ class WsServer implements HttpServerInterface { * @return string */ protected function getSubProtocolString(\Traversable $requested = null) { - if (null === $requested) { - return ''; - } - - $result = array(); - - foreach ($requested as $sub) { - if ($this->isSubProtocolSupported($sub)) { - $result[] = $sub; + if (null !== $requested) { + foreach ($requested as $sub) { + if ($this->isSubProtocolSupported($sub)) { + return $sub; + } } } - return implode(',', $result); + return ''; } /**