wip
This commit is contained in:
parent
b6b1d220ff
commit
ff7953404f
|
|
@ -58,7 +58,8 @@ class StartWebSocketServer extends Command
|
||||||
return new HttpStatisticsLogger(app(ChannelManager::class), $client);
|
return new HttpStatisticsLogger(app(ChannelManager::class), $client);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->loop->addPeriodicTimer(60, function() {
|
$this->loop->addPeriodicTimer(5, function() {
|
||||||
|
echo 'saving stats...';
|
||||||
StatisticsLogger::save($this->loop);
|
StatisticsLogger::save($this->loop);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace BeyondCode\LaravelWebSockets\Statistics\Http\Controllers;
|
namespace BeyondCode\LaravelWebSockets\Statistics\Http\Controllers;
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Statistics\Rules\AppId;
|
use BeyondCode\LaravelWebSockets\Statistics\Rules\AppId;
|
||||||
use BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class WebsocketStatisticsEntriesController
|
class WebsocketStatisticsEntriesController
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,27 @@ class HttpStatisticsLogger implements StatisticsLogger
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
|
echo 'in actual save method';
|
||||||
|
|
||||||
foreach ($this->statistics as $appId => $statistic) {
|
foreach ($this->statistics as $appId => $statistic) {
|
||||||
if (! $statistic->isEnabled()) {
|
echo "stats of ${appId} " . $statistic->isEnabled() ? 'enabled' : 'DISABLED!';
|
||||||
|
if (!$statistic->isEnabled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->client->postAsync(
|
echo 'posted';
|
||||||
|
$this->client
|
||||||
|
->postAsync(
|
||||||
action([WebsocketStatisticsEntriesController::class, 'store']),
|
action([WebsocketStatisticsEntriesController::class, 'store']),
|
||||||
$statistic->toArray()
|
$statistic->toArray()
|
||||||
);
|
)
|
||||||
|
->then(function() {
|
||||||
|
echo 'fulfilled';
|
||||||
|
})
|
||||||
|
->otherwise(function() {
|
||||||
|
echo 'rejected!';
|
||||||
|
var_dump(func_get_args());
|
||||||
|
});
|
||||||
|
|
||||||
// Reset connection and message count
|
// Reset connection and message count
|
||||||
$currentConnectionCount = collect($this->channelManager->getChannels($appId))
|
$currentConnectionCount = collect($this->channelManager->getChannels($appId))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue