websockets.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;
  3. return [
  4. /*
  5. * Set a custom dashboard configuration
  6. */
  7. 'dashboard' => [
  8. 'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
  9. ],
  10. /*
  11. * This package comes with multi tenancy out of the box. Here you can
  12. * configure the different apps that can use the webSockets server.
  13. *
  14. * Optionally you specify capacity so you can limit the maximum
  15. * concurrent connections for a specific app.
  16. *
  17. * Optionally you can disable client events so clients cannot send
  18. * messages to each other via the webSockets.
  19. */
  20. 'apps' => [
  21. [
  22. 'id' => env('PUSHER_APP_ID'),
  23. 'name' => env('APP_NAME'),
  24. 'key' => env('PUSHER_APP_KEY'),
  25. 'secret' => env('PUSHER_APP_SECRET'),
  26. 'path' => 'ws',
  27. 'capacity' => null,
  28. 'enable_client_messages' => false,
  29. 'enable_statistics' => true,
  30. ],
  31. ],
  32. /*
  33. * This class is responsible for finding the apps. The default provider
  34. * will use the apps defined in this config file.
  35. *
  36. * You can create a custom provider by implementing the
  37. * `AppProvider` interface.
  38. */
  39. 'app_provider' => BeyondCode\LaravelWebSockets\Apps\ConfigAppProvider::class,
  40. /*
  41. * This array contains the hosts of which you want to allow incoming requests.
  42. * Leave this empty if you want to accept requests from all hosts.
  43. */
  44. 'allowed_origins' => [
  45. //
  46. ],
  47. /*
  48. * The maximum request size in kilobytes that is allowed for an incoming WebSocket request.
  49. */
  50. 'max_request_size_in_kb' => 250,
  51. /*
  52. * This path will be used to register the necessary routes for the package.
  53. */
  54. 'path' => 'ws',
  55. /*
  56. * Dashboard Routes Middleware
  57. *
  58. * These middleware will be assigned to every dashboard route, giving you
  59. * the chance to add your own middleware to this list or change any of
  60. * the existing middleware. Or, you can simply stick with this list.
  61. */
  62. 'middleware' => [
  63. 'web',
  64. Authorize::class,
  65. ],
  66. 'statistics' => [
  67. /*
  68. * This model will be used to store the statistics of the WebSocketsServer.
  69. * The only requirement is that the model should extend
  70. * `WebSocketsStatisticsEntry` provided by this package.
  71. */
  72. 'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,
  73. /**
  74. * The Statistics Logger will, by default, handle the incoming statistics, store them
  75. * and then release them into the database on each interval defined below.
  76. */
  77. 'logger' => BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class,
  78. /*
  79. * Here you can specify the interval in seconds at which statistics should be logged.
  80. */
  81. 'interval_in_seconds' => 60,
  82. /*
  83. * When the clean-command is executed, all recorded statistics older than
  84. * the number of days specified here will be deleted.
  85. */
  86. 'delete_statistics_older_than_days' => 60,
  87. /*
  88. * Use an DNS resolver to make the requests to the statistics logger
  89. * default is to resolve everything to 127.0.0.1.
  90. */
  91. 'perform_dns_lookup' => false,
  92. ],
  93. /*
  94. * Define the optional SSL context for your WebSocket connections.
  95. * You can see all available options at: http://php.net/manual/en/context.ssl.php
  96. */
  97. 'ssl' => [
  98. /*
  99. * Path to local certificate file on filesystem. It must be a PEM encoded file which
  100. * contains your certificate and private key. It can optionally contain the
  101. * certificate chain of issuers. The private key also may be contained
  102. * in a separate file specified by local_pk.
  103. */
  104. 'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),
  105. /*
  106. * Path to local private key file on filesystem in case of separate files for
  107. * certificate (local_cert) and private key.
  108. */
  109. 'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),
  110. /*
  111. * Passphrase for your local_cert file.
  112. */
  113. 'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
  114. ],
  115. /*
  116. * Channel Manager
  117. * This class handles how channel persistence is handled.
  118. * By default, persistence is stored in an array by the running webserver.
  119. * The only requirement is that the class should implement
  120. * `ChannelManager` interface provided by this package.
  121. */
  122. 'channel_manager' => \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager::class,
  123. ];