Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug #1

Open
fangxingguang opened this issue Dec 28, 2016 · 3 comments
Open

bug #1

fangxingguang opened this issue Dec 28, 2016 · 3 comments

Comments

@fangxingguang
Copy link

protected $socket = 'websocket://0.0.0.0:2346';
protected $processes = 1;
public $uidConnections = array();

public function onWorkerStart($worker)
{
    echo 'work start!';
    //开启一个内部端口,方便内部系统推送数据,Text协议格式 文本+换行符
    $inner_text_worker = new Worker('text://0.0.0.0:5678');
    $inner_text_worker->onMessage = function($connection, $buffer)
    {
        global $worker;
        // $data数组格式,里面有uid,表示向那个uid的页面推送数据
        $data = json_decode($buffer, true);
        $uid = $data['uid'];
        // 通过workerman,向uid的页面推送数据
        $ret = $this->sendMessageByUid($uid, $buffer);
        // 返回推送结果
        $connection->send($ret ? 'ok' : 'fail');
    };
    // ## 执行监听 ##
    $inner_text_worker->listen();
} `

`
onWorkerStart 内部启动worker会报错,貌似陷入死循环

work start!Workerman[server.php] start in DEBUG mode
Workerman[server.php] already running
WORKER EXIT UNEXPECTED
work start!Workerman[server.php] start in DEBUG mode
Workerman[server.php] already running
WORKER EXIT UNEXPECTED
work start!Workerman[server.php] start in DEBUG mode
Workerman[server.php] already running
WORKER EXIT UNEXPECTED
work start!Workerman[server.php] start in DEBUG mode
Workerman[server.php] already running
WORKER EXIT UNEXPECTED
work start!Workerman[server.php] start in DEBUG mode
Workerman[server.php] already running
WORKER EXIT UNEXPECTED
work start!Workerman[server.php] start in DEBUG mode
Workerman[server.php] already running
WORKER EXIT UNEXPECTED

@18y
Copy link

18y commented Jun 17, 2017

有例子不用,瞎几把搞。

@sui28456049
Copy link

老哥,稳

@xiaorui16888
Copy link

有例子不用,瞎几把搞。

向指定客户端返回数据的例子在哪儿?你来给咱说说???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants