gateway_worker.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | Workerman设置 仅对 php think worker:gateway 指令有效
  13. // +----------------------------------------------------------------------
  14. return [
  15. // 扩展自身需要的配置
  16. 'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
  17. 'host' => '0.0.0.0', // 监听地址
  18. 'port' => 2348, // 监听端口
  19. 'socket' => '', // 完整监听地址
  20. 'context' => [], // socket 上下文选项
  21. 'register_deploy' => true, // 是否需要部署register
  22. 'businessWorker_deploy' => true, // 是否需要部署businessWorker
  23. 'gateway_deploy' => true, // 是否需要部署gateway
  24. // Register配置
  25. 'registerAddress' => '127.0.0.1:1236',
  26. // Gateway配置
  27. 'name' => 'thinkphp',
  28. 'count' => 1,
  29. 'lanIp' => '127.0.0.1',
  30. 'startPort' => 2000,
  31. 'daemonize' => false,
  32. 'pingInterval' => 30,
  33. 'pingNotResponseLimit' => 0,
  34. 'pingData' => '{"type":"ping"}',
  35. // BusinsessWorker配置
  36. 'businessWorker' => [
  37. 'name' => 'BusinessWorker',
  38. 'count' => 1,
  39. 'eventHandler' => '\think\worker\Events',
  40. ],
  41. ];