/**
* Created by PhpStorm.
* User: qyc
* Date: 2017/10/22
* Time: 下午4:40
*/
define('HOST', '0.0.0.0');
define('PORT', '9502');
define('WORKER_NUM', 8);
define('DISPATCH_MODE', 2);
define('DAEMONIZE', 0);
class swoole_ws
{
private $pdo;
private $server;
//这里写死了数据表,之后完成数据库监听后改写这里逻辑
private $table
= [
'swoole_test',
];
public function __construct()
{
$this->server = new swoole_websocket_server(HOST, PORT);
$this->server->set(
[
//开启woker进程数
'worker_num' => WORKER_NUM,
//请求分发策略,
'dispatch_mode' => DISPATCH_MODE,
//是否守护进程
'daemonize' => D