multi workers init in one php file are not support

xaboy

windows操作系统下无法在一个php文件里初始化多个Worker
当前在 workerStart 事件中调用 Client::connect()
其他环境没问题, windows环境下会提示multi workers init in one php file are not support
 请问在windows 环境下怎么实现在 workerman 中使用 Channel 通讯呢?

[attach]2331[/attach]
 

6825 2 0
2个回答

walkor
  • xaboy 2019-07-26

    这个我看了 是不是我的思路有问题

xaboy

我在 windows 环境下将这几个服务拆开
 
但是在 worker 的 onWorkerStart 事件中要连接一下 Channel 然后绑定事件
[attach]2332[/attach]

  • walkor 2019-07-26

    文档让windows下拆成不同的文件,你这个不是都在一个文件里么?

  • xaboy 2019-07-26

    我想着是通过3次命令分别开启
    php think workerman start channel
    php think workerman start admin
    php think workerman start chat

  • xaboy 2019-07-26

    @1: 运行php think workerman start channel没问题
    运行php think workerman start admin 的时候就会提示
    multi workers init in one php file are not support
    发是因为在onWrokerStart 中执行了 Client::connect

  • walkor 2019-07-26

    检查下业务逻辑吧,应该是哪里初始化了多个容器

  • xaboy 2019-07-26

    感谢你的回复
    我刚刚检查了一下发现Channel 监听的 IP是'0.0.0.0'时会重复提示Waring channel connection closed and try to reconnect,原因不知道,改掉就好

年代过于久远,无法发表回答
🔝