[WebSocket] Only select one sub-protocol, fixes #103

This commit is contained in:
Chris Boden 2013-07-20 12:38:23 -04:00
parent e9d19c95ab
commit bb0896ab12

View File

@ -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 '';
}
/**