22
33namespace BeyondCode \LaravelWebSockets \Console ;
44
5+ use React \Socket \Connector ;
6+ use Clue \React \Buzz \Browser ;
7+ use Illuminate \Console \Command ;
8+ use React \EventLoop \Factory as LoopFactory ;
9+ use BeyondCode \LaravelWebSockets \Statistics \DnsResolver ;
510use BeyondCode \LaravelWebSockets \Facades \StatisticsLogger ;
611use BeyondCode \LaravelWebSockets \Facades \WebSocketsRouter ;
7- use BeyondCode \LaravelWebSockets \Server \Logger \ConnectionLogger ;
812use BeyondCode \LaravelWebSockets \Server \Logger \HttpLogger ;
13+ use BeyondCode \LaravelWebSockets \Server \WebSocketServerFactory ;
14+ use BeyondCode \LaravelWebSockets \Server \Logger \ConnectionLogger ;
915use BeyondCode \LaravelWebSockets \Server \Logger \WebsocketsLogger ;
10- use BeyondCode \LaravelWebSockets \Statistics \ DnsResolver ;
16+ use BeyondCode \LaravelWebSockets \WebSockets \ Channels \ ChannelManager ;
1117use BeyondCode \LaravelWebSockets \Statistics \Logger \HttpStatisticsLogger ;
1218use BeyondCode \LaravelWebSockets \Statistics \Logger \StatisticsLogger as StatisticsLoggerInterface ;
1319
14- use BeyondCode \LaravelWebSockets \WebSockets \Channels \ChannelManager ;
15- use Clue \React \Buzz \Browser ;
16- use Illuminate \Console \Command ;
17- use BeyondCode \LaravelWebSockets \Server \WebSocketServerFactory ;
18-
19- use React \EventLoop \Factory as LoopFactory ;
20- use React \Socket \Connector ;
21-
2220class StartWebSocketServer extends Command
2321{
2422 protected $ signature = 'websockets:serve {--host=0.0.0.0} {--port=6001} ' ;
@@ -49,16 +47,16 @@ public function handle()
4947 protected function configureStatisticsLogger ()
5048 {
5149 $ connector = new Connector ($ this ->loop , [
52- 'dns ' => new DnsResolver ()
50+ 'dns ' => new DnsResolver (),
5351 ]);
5452
5553 $ browser = new Browser ($ this ->loop , $ connector );
5654
57- app ()->singleton (StatisticsLoggerInterface::class, function () use ($ browser ) {
55+ app ()->singleton (StatisticsLoggerInterface::class, function () use ($ browser ) {
5856 return new HttpStatisticsLogger (app (ChannelManager::class), $ browser );
5957 });
6058
61- $ this ->loop ->addPeriodicTimer (config ('websockets.statistics.interval_in_seconds ' ), function () {
59+ $ this ->loop ->addPeriodicTimer (config ('websockets.statistics.interval_in_seconds ' ), function () {
6260 StatisticsLogger::save ();
6361 });
6462
@@ -67,7 +65,7 @@ protected function configureStatisticsLogger()
6765
6866 protected function configureHttpLogger ()
6967 {
70- app ()->singleton (HttpLogger::class, function () {
68+ app ()->singleton (HttpLogger::class, function () {
7169 return (new HttpLogger ($ this ->output ))
7270 ->enable (config ('app.debug ' ))
7371 ->verbose ($ this ->output ->isVerbose ());
@@ -78,7 +76,7 @@ protected function configureHttpLogger()
7876
7977 protected function configureMessageLogger ()
8078 {
81- app ()->singleton (WebsocketsLogger::class, function () {
79+ app ()->singleton (WebsocketsLogger::class, function () {
8280 return (new WebsocketsLogger ($ this ->output ))
8381 ->enable (config ('app.debug ' ))
8482 ->verbose ($ this ->output ->isVerbose ());
@@ -89,7 +87,7 @@ protected function configureMessageLogger()
8987
9088 protected function configureConnectionLogger ()
9189 {
92- app ()->bind (ConnectionLogger::class, function () {
90+ app ()->bind (ConnectionLogger::class, function () {
9391 return (new ConnectionLogger ($ this ->output ))
9492 ->enable (config ('app.debug ' ))
9593 ->verbose ($ this ->output ->isVerbose ());
@@ -111,7 +109,7 @@ protected function startWebSocketServer()
111109
112110 $ routes = WebSocketsRouter::getRoutes ();
113111
114- /** 🛰 Start the server 🛰 */
112+ /* 🛰 Start the server 🛰 */
115113 (new WebSocketServerFactory ())
116114 ->setLoop ($ this ->loop )
117115 ->useRoutes ($ routes )
0 commit comments