public static function runUpdateQuery($sqlPool, $cbEvent = null) { Instance::getMysql()->getConnection(function ($sess) use($sqlPool, $cbEvent) { foreach ($sqlPool as $sql) { $sess->query($sql, function ($sess, $ok) use($sql, $cbEvent) { if ($ok) { Debug::log(__METHOD__ . '() [' . $sql . '] complete run.'); } else { Debug::error(__METHOD__ . '() [' . $sql . '] has error[' . $sess->errno . ':' . $sess->errmsg . '].'); } if ($cbEvent instanceof CbEvent) { $cbEvent->doCall($sess, $ok); } }); } }); }
public function onWrite() { Debug::netModuleEvent(get_class($this) . '::' . __METHOD__ . '(' . $this->connId . ') invoked. '); }
protected function onConnected($connId, $addr, $port) { Debug::log(get_class($this) . '::' . __METHOD__ . '(' . $connId . ') invoked. '); $sess = $this->setConnSocketSession($connId, new testClientSocketSession($this)); $sess->write("GET / HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: Close\r\n\r\n"); }
public function onClose() { Debug::log(get_class($this) . '::' . __METHOD__ . ' : webSocketSession onClose id[' . $this->client->getConnId() . ']'); unset(self::$clientPool[$this->client->getConnId()]); }