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

Commit ff79534

Browse files
committed
wip
1 parent b6b1d22 commit ff79534

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/Console/StartWebSocketServer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ protected function configureStatisticsLogger()
5858
return new HttpStatisticsLogger(app(ChannelManager::class), $client);
5959
});
6060

61-
$this->loop->addPeriodicTimer(60, function() {
61+
$this->loop->addPeriodicTimer(5, function() {
62+
echo 'saving stats...';
6263
StatisticsLogger::save($this->loop);
6364
});
6465

src/Statistics/Http/Controllers/WebsocketStatisticsEntriesController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace BeyondCode\LaravelWebSockets\Statistics\Http\Controllers;
44

55
use BeyondCode\LaravelWebSockets\Statistics\Rules\AppId;
6-
use BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry;
76
use Illuminate\Http\Request;
87

98
class WebsocketStatisticsEntriesController

src/Statistics/Logger/HttpStatisticsLogger.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,27 @@ protected function initializeStatistics($id)
6060

6161
public function save()
6262
{
63+
echo 'in actual save method';
64+
6365
foreach ($this->statistics as $appId => $statistic) {
64-
if (! $statistic->isEnabled()) {
66+
echo "stats of ${appId} " . $statistic->isEnabled() ? 'enabled' : 'DISABLED!';
67+
if (!$statistic->isEnabled()) {
6568
continue;
6669
}
6770

68-
$this->client->postAsync(
69-
action([WebsocketStatisticsEntriesController::class, 'store']),
70-
$statistic->toArray()
71-
);
71+
echo 'posted';
72+
$this->client
73+
->postAsync(
74+
action([WebsocketStatisticsEntriesController::class, 'store']),
75+
$statistic->toArray()
76+
)
77+
->then(function() {
78+
echo 'fulfilled';
79+
})
80+
->otherwise(function() {
81+
echo 'rejected!';
82+
var_dump(func_get_args());
83+
});
7284

7385
// Reset connection and message count
7486
$currentConnectionCount = collect($this->channelManager->getChannels($appId))

0 commit comments

Comments
 (0)