swoole websocket 刚起的时候可以连接,一会就不行了 failed: Invalid frame header

simple__ 发布于 2017/07/14 13:56
阅读 3K+
收藏 0

swoole websocket 刚起的时候可以连接,一会就不行了 
报错是:
failed: Invalid frame header
查了一下 进程是在的

加上了日志
结果报
zm_deactivate_swoole (ERROR 9003): worker process is terminated by exit()/die().、

而且一直在报, 看网上也有很多人遇到相同的情况,可是没找到解决方案,求大神们指点

 

$table = new swoole_table(1024);
        $table->column('fd', swoole_table::TYPE_INT);
        $table->create();


        $serv = new swoole_websocket_server("0.0.0.0", 9502);
        $serv->addlistener('0.0.0.0', 9503, SWOOLE_SOCK_TCP);
        $serv->table = $table;


        $serv->on('Open', function($server, $req) {
            $server->table->set($req->fd, array('fd' => $req->fd));//获取客户端id插入table
            $log =  "connection open: ".$req->fd."\n";
            echo $log;
            Logger::write($log);
        });

    
        $serv->on('Message', function($server, $frame) {
            $fd = $frame->fd;
            $info = $server->connection_info($fd);
            $log = "fd:".$frame->fd." data:".$frame->data."\n";
            echo $log;
            Logger::write($log);
            if( $info['server_port'] == 9503 )
                   $server->push($fd, "you are admin");
             else{
                 $server->push($fd, "this is server");
             }
        });

        $serv->on('Close', function($server, $fd) {
            $log = "connection close: ".$fd."\n";
            $server->table->del($fd); //从table中删除断开的id
            echo $log;
            Logger::write($log);

        });

        $serv->start();

 

 

 

加载中
0
mickelfeng
mickelfeng

代码中是否包含exit()/die() 等函数

哟西万花筒
哟西万花筒
回复 @simple__ :
simple__
simple__
我嵌套在我原有的框架之内的,应该是某一块有exit或die ,我单独提起出来,貌似可以了,感谢
返回顶部
顶部