public function testCreateClient() { $factory = new Factory(self::$loop); $promise = $factory->createClient(self::$host); $client = Block\await($promise, self::$loop, 10.0); return $client; }
use Clue\React\Quassel\Client; use Clue\React\Quassel\Io\Protocol; require __DIR__ . '/../vendor/autoload.php'; $debug = false; $host = '127.0.0.1'; $user = array(); if (isset($argv[1])) { $host = $argv[1]; } echo 'Server: ' . $host . PHP_EOL; echo 'User name: '; $user['name'] = trim(fgets(STDIN)); echo 'Password: '******'password'] = trim(fgets(STDIN)); $loop = \React\EventLoop\Factory::create(); $factory = new Factory($loop); $factory->createClient($host)->then(function (Client $client) use($loop, $user, $debug) { var_dump('CONNECTED'); if ($debug) { $client->on('data', function ($message) { var_dump($message); }); } $client->on('data', function ($message) use($client, $user) { $type = null; if (is_array($message) && isset($message['MsgType'])) { $type = $message['MsgType']; } if ($type === 'ClientInitAck') { if (!$message['Configured']) { var_dump('core not configured yet, you may want to issue a setup call manually');