websockets.php 4.1 KB

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