getIdFromConnection() public static method

Return id of connection context for connection.
public static getIdFromConnection ( Ratchet\ConnectionInterface $conn ) : string
$conn Ratchet\ConnectionInterface
return string
示例#1
0
 /**
  * Returns websocket context for given connection.
  *
  * @param ConnectionInterface $conn
  *
  * @return ConnectionContextInterface
  */
 protected function getContext(ConnectionInterface $conn)
 {
     $id = ConnectionContext::getIdFromConnection($conn);
     if (!$this->contexts->contains($id)) {
         $this->saveContext($this->createContext($conn));
     }
     return $this->contexts->fetch($id);
 }