reverb.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. return [
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Default Reverb Server
  6. |--------------------------------------------------------------------------
  7. |
  8. | This option controls the default server used by Reverb to handle
  9. | incoming messages as well as broadcasting message to all your
  10. | connected clients. At this time only "reverb" is supported.
  11. |
  12. */
  13. 'default' => env('REVERB_SERVER', 'reverb'),
  14. /*
  15. |--------------------------------------------------------------------------
  16. | Reverb Servers
  17. |--------------------------------------------------------------------------
  18. |
  19. | Here you may define details for each of the supported Reverb servers.
  20. | Each server has its own configuration options that are defined in
  21. | the array below. You should ensure all the options are present.
  22. |
  23. */
  24. 'servers' => [
  25. 'reverb' => [
  26. 'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
  27. 'port' => env('REVERB_SERVER_PORT', 8080),
  28. 'path' => env('REVERB_SERVER_PATH', ''),
  29. 'hostname' => env('REVERB_HOST'),
  30. 'options' => [
  31. 'tls' => [],
  32. ],
  33. // Laravel 推送事件的 HTTP 请求体上限;后台列表行可能超过 10KB,默认放宽到 512KB
  34. 'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 524_288),
  35. 'scaling' => [
  36. 'enabled' => env('REVERB_SCALING_ENABLED', false),
  37. 'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
  38. 'server' => [
  39. 'url' => env('REDIS_URL'),
  40. 'host' => env('REDIS_HOST', '127.0.0.1'),
  41. 'port' => env('REDIS_PORT', '6379'),
  42. 'username' => env('REDIS_USERNAME'),
  43. 'password' => env('REDIS_PASSWORD'),
  44. 'database' => env('REDIS_DB', '0'),
  45. 'timeout' => env('REDIS_TIMEOUT', 60),
  46. ],
  47. ],
  48. 'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
  49. 'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15),
  50. ],
  51. ],
  52. /*
  53. |--------------------------------------------------------------------------
  54. | Reverb Applications
  55. |--------------------------------------------------------------------------
  56. |
  57. | Here you may define how Reverb applications are managed. If you choose
  58. | to use the "config" provider, you may define an array of apps which
  59. | your server will support, including their connection credentials.
  60. |
  61. */
  62. 'apps' => [
  63. 'provider' => 'config',
  64. 'apps' => [
  65. [
  66. 'key' => env('REVERB_APP_KEY'),
  67. 'secret' => env('REVERB_APP_SECRET'),
  68. 'app_id' => env('REVERB_APP_ID'),
  69. 'options' => [
  70. 'host' => env('REVERB_HOST'),
  71. 'port' => env('REVERB_PORT', 443),
  72. 'scheme' => env('REVERB_SCHEME', 'https'),
  73. 'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
  74. ],
  75. // 允许连接的前端域名(不含协议),逗号分隔,例如 admin.example.com;未配置时不限制
  76. 'allowed_origins' => array_values(array_filter(array_map('trim', explode(',', (string) env('REVERB_ALLOWED_ORIGINS', '*'))))),
  77. 'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
  78. 'activity_timeout' => env('REVERB_APP_ACTIVITY_TIMEOUT', 30),
  79. 'max_connections' => env('REVERB_APP_MAX_CONNECTIONS'),
  80. 'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
  81. // 后台推送只有服务端下发,不接受前端 whisper 等客户端事件
  82. 'accept_client_events_from' => env('REVERB_APP_ACCEPT_CLIENT_EVENTS_FROM', 'none'),
  83. 'rate_limiting' => [
  84. 'enabled' => env('REVERB_APP_RATE_LIMITING_ENABLED', false),
  85. 'max_attempts' => env('REVERB_APP_RATE_LIMIT_MAX_ATTEMPTS', 60),
  86. 'decay_seconds' => env('REVERB_APP_RATE_LIMIT_DECAY_SECONDS', 60),
  87. 'terminate_on_limit' => env('REVERB_APP_RATE_LIMIT_TERMINATE', false),
  88. ],
  89. ],
  90. ],
  91. ],
  92. ];