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