Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 0380f5e

Browse files
authored
Octane fixes (#734)
1 parent 583022a commit 0380f5e

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/Console/StartWebSocketServer.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ protected function configureStatisticsLogger()
6464

6565
$browser = new Browser($this->loop, $connector);
6666

67-
app()->singleton(StatisticsLoggerInterface::class, function () use ($browser) {
68-
$class = config('websockets.statistics.logger', \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class);
67+
app()->singleton(StatisticsLoggerInterface::class, function ($app) use ($browser) {
68+
$config = $app['config']['websockets'];
69+
$class = $config['statistics']['logger'] ?? \BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger::class;
6970

7071
return new $class(app(ChannelManager::class), $browser);
7172
});
@@ -79,9 +80,9 @@ protected function configureStatisticsLogger()
7980

8081
protected function configureHttpLogger()
8182
{
82-
app()->singleton(HttpLogger::class, function () {
83+
app()->singleton(HttpLogger::class, function ($app) {
8384
return (new HttpLogger($this->output))
84-
->enable($this->option('debug') ?: config('app.debug'))
85+
->enable($this->option('debug') ?: ($app['config']['app']['debug'] ?? false))
8586
->verbose($this->output->isVerbose());
8687
});
8788

@@ -90,9 +91,9 @@ protected function configureHttpLogger()
9091

9192
protected function configureMessageLogger()
9293
{
93-
app()->singleton(WebsocketsLogger::class, function () {
94+
app()->singleton(WebsocketsLogger::class, function ($app) {
9495
return (new WebsocketsLogger($this->output))
95-
->enable($this->option('debug') ?: config('app.debug'))
96+
->enable($this->option('debug') ?: ($app['config']['app']['debug'] ?? false))
9697
->verbose($this->output->isVerbose());
9798
});
9899

@@ -101,9 +102,9 @@ protected function configureMessageLogger()
101102

102103
protected function configureConnectionLogger()
103104
{
104-
app()->bind(ConnectionLogger::class, function () {
105+
app()->bind(ConnectionLogger::class, function ($app) {
105106
return (new ConnectionLogger($this->output))
106-
->enable(config('app.debug'))
107+
->enable($app['config']['app']['debug'] ?? false)
107108
->verbose($this->output->isVerbose());
108109
});
109110

src/WebSocketsServiceProvider.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,17 @@ public function register()
5050
return new Router();
5151
});
5252

53-
$this->app->singleton(ChannelManager::class, function () {
54-
return config('websockets.channel_manager') !== null && class_exists(config('websockets.channel_manager'))
55-
? app(config('websockets.channel_manager')) : new ArrayChannelManager();
53+
$this->app->singleton(ChannelManager::class, function ($app) {
54+
$config = $app['config']['websockets'];
55+
56+
return ($config['channel_manager'] ?? null) !== null && class_exists($config['channel_manager'])
57+
? app($config['channel_manager']) : new ArrayChannelManager();
5658
});
5759

58-
$this->app->singleton(AppProvider::class, function () {
59-
return app(config('websockets.app_provider'));
60+
$this->app->singleton(AppProvider::class, function ($app) {
61+
$config = $app['config']['websockets'];
62+
63+
return app($config['app_provider']);
6064
});
6165
}
6266

0 commit comments

Comments
 (0)