Merge branch 'master' of github.com:beyondcode/laravel-websockets

This commit is contained in:
freek 2018-12-03 13:50:09 +01:00
commit d0ad7e6530
2 changed files with 10 additions and 1 deletions

View File

@ -57,7 +57,9 @@ class Logger
public function save() public function save()
{ {
foreach ($this->statistics as $appId => $statistic) { foreach ($this->statistics as $appId => $statistic) {
// TODO: perform http request if ($statistic->isEnabled()) {
// TODO: perform http request
}
// Reset connection and message count // Reset connection and message count
$connections = Collection::make($this->channelManager->getChannels($appId))->sum(function ($channel) { $connections = Collection::make($this->channelManager->getChannels($appId))->sum(function ($channel) {

View File

@ -2,6 +2,8 @@
namespace BeyondCode\LaravelWebSockets\Statistics\Logging; namespace BeyondCode\LaravelWebSockets\Statistics\Logging;
use BeyondCode\LaravelWebSockets\Apps\App;
class Statistic class Statistic
{ {
/** @var int|string */ /** @var int|string */
@ -24,6 +26,11 @@ class Statistic
$this->appId = $appId; $this->appId = $appId;
} }
public function isEnabled(): bool
{
return App::findById($this->appId)->statisticsEnabled;
}
public function connection() public function connection()
{ {
$this->connections++; $this->connections++;