【发布时间】:2015-09-27 04:52:54
【问题描述】:
嗨,我正在用 php 编写一个简单的游戏,
对于这项工作,我使用 http://socketo.me 它有一个方法“onOpen()”,就像这段代码
php:
public function onOpen(ConnectionInterface $conn) {
// Store the new connection to send messages to later
$this->clients->attach($conn);
echo "New connection! ({$conn->resourceId})\n";
}
我可以为每个包含resourceId或remoteAddress(客户端的IP地址)的客户端访问ConnectionInterface
但是在我的应用程序中,人们首先登录到网站,然后他们连接到服务器,但我从服务器上的客户端获得的唯一东西是 ConnectionInterface
我怎么知道每个 $conn 是针对哪个用户的?
【问题讨论】: