当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::getId方法代码示例

本文整理汇总了PHP中Connection::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getId方法的具体用法?PHP Connection::getId怎么用?PHP Connection::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addConnection

 public function addConnection(Connection $connection)
 {
     if (!isset($this->connections[$connection->getId()])) {
         $this->connections[$connection->getId()] = $connection;
     }
     return $this;
 }
开发者ID:holmesmedia,项目名称:java-script-remote-console,代码行数:7,代码来源:ConnectionRepository.php

示例2: connect

 /**
  * Registers the socket with a new Connection object and stores that
  * @param resource The socket for the new client
  */
 private function connect($clientSocket)
 {
     $connection = new Connection($clientSocket);
     $this->connections[$connection->getId()] = $connection;
     $this->sockets[$connection->getId()] = $clientSocket;
     //we throw a new event to handle new connections
     $onConnectingEvent = new \System\Web\Websocket\Event\OnConnectingEvent();
     $onConnectingEvent->setServer($this);
     $onConnectingEvent->setConnection($connection);
     $onConnectingEvent->raise();
 }
开发者ID:Superbeest,项目名称:Core,代码行数:15,代码来源:Server.class.php

示例3: checkRequestsPerMinute

 /**
  * NOT idempotent, call once per data
  *
  * @param Connection $connection
  */
 protected function checkRequestsPerMinute($connection)
 {
     $id = $connection->getId();
     if (!isset($this->requests[$id])) {
         $this->requests[$id] = array();
     }
     // Add current token
     $this->requests[$id][] = time();
     // Expire old tokens
     while (reset($this->requests[$id]) < time() - 60) {
         array_shift($this->requests[$id]);
     }
     if (count($this->requests[$id]) > $this->options['requests_per_minute']) {
         $this->limit($connection, 'Requests per minute');
     }
 }
开发者ID:rakesh-mohanta,项目名称:Sunrise,代码行数:21,代码来源:RateLimiter.php

示例4: addConnection

 public function addConnection(Connection $connection)
 {
     $this->connections[$connection->getId()] = $connection;
 }
开发者ID:dbtk,项目名称:config,代码行数:4,代码来源:Cluster.php

示例5: remove

 public function remove(Connection $connection)
 {
     unset($this->connections[$connection->getId()]);
 }
开发者ID:rezonant,项目名称:datasha,代码行数:4,代码来源:ConnectionStore.php


注:本文中的Connection::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。