This repository was archived by the owner on Feb 7, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 8080 */
8181 'delete_statistics_older_than_days ' => 60 ,
8282
83+ /*
84+ * By default, the websockets server attempts to connect to whatever
85+ * your APP_URL is set to. If running in a more complex environment,
86+ * you may wish to override the base URL for internal requests to
87+ * allow statistics to be collected.
88+ */
89+ 'base_url_override ' => null ,
90+
8391 /*
8492 * Use an DNS resolver to make the requests to the statistics logger
8593 * default is to resolve everything to 127.0.0.1.
Original file line number Diff line number Diff line change @@ -65,6 +65,19 @@ protected function findOrMakeStatisticForAppId($appId): Statistic
6565 return $ this ->statistics [$ appId ];
6666 }
6767
68+ protected function getUrl (): string
69+ {
70+ $ action = [WebSocketStatisticsEntriesController::class, 'store ' ];
71+
72+ $ url_override = config ('websockets.statistics.base_url_override ' , null );
73+
74+ if ($ url_override !== null ) {
75+ return $ url_override .action ($ action , [], false );
76+ }
77+
78+ return action ($ action );
79+ }
80+
6881 public function save ()
6982 {
7083 foreach ($ this ->statistics as $ appId => $ statistic ) {
@@ -79,7 +92,7 @@ public function save()
7992 $ this
8093 ->browser
8194 ->post (
82- action ([WebSocketStatisticsEntriesController::class, ' store ' ] ),
95+ $ this -> getUrl ( ),
8396 ['Content-Type ' => 'application/json ' ],
8497 stream_for (json_encode ($ postData ))
8598 );
You can’t perform that action at this time.
0 commit comments