2020-08-18 18:22:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace BeyondCode\LaravelWebSockets\Statistics\Drivers;
|
|
|
|
|
|
2020-08-20 08:27:55 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
2020-08-18 18:22:29 +00:00
|
|
|
interface StatisticsDriver
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Initialize the driver with a stored record.
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $record
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($record = null);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the app ID for the stats.
|
|
|
|
|
*
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function getAppId();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the time value. Should be Y-m-d H:i:s.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getTime(): string;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the peak connection count for the time.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getPeakConnectionCount(): int;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the websocket messages count for the time.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getWebsocketMessageCount(): int;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the API message count for the time.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getApiMessageCount(): int;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new statistic in the store.
|
|
|
|
|
*
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return \BeyondCode\LaravelWebSockets\Statistics\Drivers\StatisticsDriver
|
|
|
|
|
*/
|
|
|
|
|
public static function create(array $data): StatisticsDriver;
|
|
|
|
|
|
2020-08-20 08:27:55 +00:00
|
|
|
/**
|
|
|
|
|
* Get the records to show to the dashboard.
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $appId
|
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public static function get($appId, Request $request);
|
|
|
|
|
|
2020-08-18 18:22:29 +00:00
|
|
|
/**
|
|
|
|
|
* Delete statistics from the store,
|
|
|
|
|
* optionally by app id, returning
|
|
|
|
|
* the number of deleted records.
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $appId
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public static function delete($appId = null): int;
|
|
|
|
|
}
|