本文整理匯總了PHP中Connection::write方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::write方法的具體用法?PHP Connection::write怎麽用?PHP Connection::write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Connection
的用法示例。
在下文中一共展示了Connection::write方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send
/**
* @param string $message
* @param string $from
* @param string $color
*
* @throws \RuntimeException
*/
public function send($message, $from, $color = null)
{
$data = ['room_id' => $this->name, 'message' => $message, 'from' => $from];
if ($color) {
$data['color'] = $color;
}
$this->connection->write('/v1/rooms/message', $data);
}
示例2: quitCommand
public function quitCommand($command, $params, IrcDataObject $data)
{
$auth = $this->parent->getModule('Auth');
if (!$auth->nicknameIsTrusted($data->getMessage()['nick'])) {
return;
}
$message = empty($params) ? 'WildPHP shutting down...' : $params;
$this->parent->write($this->parent->getGenerator()->ircQuit($message));
}
示例3: pingPong
/**
* @param IrcDataObject $data
*/
public function pingPong(IrcDataObject $data)
{
$this->parent->write($this->parent->getGenerator()->ircPong($data->getParams()['server1']));
}
示例4: send
public function send()
{
if ($this->conn->write() === false) {
$this->finish('BROKEN');
}
}
示例5: write
function write()
{
if ($this->current_client == null) {
if (empty($this->client_queue)) {
return;
}
$this->current_client = $this->client_queue[0];
}
while ($packet = array_shift($this->current_client->packets_read)) {
$this->write_buffer->append($packet->binary);
}
parent::write();
}
示例6: write
function write()
{
// $this->log("Writing to client.\n");
while ($packet = array_shift($this->write_packets)) {
$this->write_buffer->append($packet->binary);
}
parent::write();
}