Php Ratchet-无法在服务器端获取查询字符串

Php Ratchet-无法在服务器端获取查询字符串,php,websocket,ratchet,Php,Websocket,Ratchet,在客户端: var ws = new WebSocket('ws://localhost:8082/chat?id=123&tid=7'); 在服务器端 class MyApp implements MessageComponentInterface { protected $clients; public function __construct() { $this->clients = new \SplObjectStorage; }

在客户端:

var ws = new WebSocket('ws://localhost:8082/chat?id=123&tid=7');
在服务器端

class MyApp implements MessageComponentInterface {
    protected $clients;

    public function __construct() {
        $this->clients = new \SplObjectStorage;
    }

    public function onOpen(ConnectionInterface $conn) {

        var_dump($conn->WebSocket->request->getQuery()); // I tried to access to query string here, but it did not work
        $this->clients->attach($conn);
    }

...
}
这是我从控制台得到的转储结果

class Guzzle\Http\QueryString#85 (5) {
  protected $fieldSeparator =>
  string(1) "&"
  protected $valueSeparator =>
  string(1) "="
  protected $urlEncode =>
  string(8) "RFC 3986"
  protected $aggregator =>
  NULL
  protected $data =>
  array(0) {
  }
}
我看不到关于我的URL
id
tid
上两个查询字符串的值的任何线索。 更新:我尝试在Http/Route上转储变量
$request
中的所有内容以进行检查,我可以看到getQuery可以工作,但是如何在函数onOpen上执行相同的操作

 protected $url =>
 class Guzzle\Http\Url#67 (8) {
   protected $scheme =>
   string(4) "http"
   protected $host =>
   string(9) "localhost"
   protected $port =>
   int(8082)
   protected $username =>
   NULL
   protected $password =>
   NULL
   protected $path =>
   string(5) "/chat"
   protected $fragment =>
   NULL
   protected $query =>
   class Guzzle\Http\QueryString#66 (5) {
     protected $fieldSeparator =>
     string(1) "&"
     protected $valueSeparator =>
     string(1) "="
     protected $urlEncode =>
     string(8) "RFC 3986"
     protected $aggregator =>
     NULL
     protected $data =>
     array(3) {
       ...
     }
   }
 }
消息在客户端和服务器之间正确传输,但查询字符串不正确。
非常感谢您的帮助。

我不太理解src\Ratchet\Http中的以下代码,因此我不确定这是否是一个bug

$parameters = array();

        foreach($route as $key => $value) {
            if ((is_string($key)) && ('_' !== substr($key, 0, 1))) {
                $parameters[$key] = $value;
            }
        }

 $url = Url::factory($request->getPath());
        $url->setQuery($parameters);
但我修改如下:

$parameters = $request->getQuery();
我上面的一行将覆盖迭代,以便在
$params
中设置一些内容。至少我可以访问查询字符串