<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/23
 * Time: 17:42
 */


define('START_TIME', microtime(true));
require __DIR__.'/../vendor/autoload.php';
\app\lib\boot::init();



use WebSocket\Client as Client;

$conf = \app\lib\GlobConfigs::getKey('admin_conf');
$url = "?token=".$conf['admin_token'];
$client = new Client("ws://192.168.2.200:9090/".$url);


$str = '{"cmd":"test","act":"broad","data":"你好,朋友们!","time":1558492565,"token":"aasasfa"}';

$r = $client->send($str);
$msg = $client->receive();
echo "Recive: ".$msg."\n\n\n";
$msg = $client->receive();
echo "Recive: ".$msg."\n\n\n";
sleep(3);

$r = $client->send($str);
$msg = $client->receive();
echo "Recive: ".$msg."\n\n\n";
sleep(3);

$r = $client->send($str);
$msg = $client->receive();
echo "Recive: ".$msg."\n\n\n";


$client->close();





