Issues (192)

src/Contracts/StatisticsCollector.php (2 issues)

1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Contracts;
4
5
use React\Promise\PromiseInterface;
6
7
interface StatisticsCollector
8
{
9
    /**
10
     * Handle the incoming websocket message.
11
     *
12
     * @param  string|int  $appId
13
     * @return void
14
     */
15
    public function webSocketMessage($appId);
16
17
    /**
18
     * Handle the incoming API message.
19
     *
20
     * @param  string|int  $appId
21
     * @return void
22
     */
23
    public function apiMessage($appId);
24
25
    /**
26
     * Handle the new conection.
27
     *
28
     * @param  string|int  $appId
29
     * @return void
30
     */
31
    public function connection($appId);
32
33
    /**
34
     * Handle disconnections.
35
     *
36
     * @param  string|int  $appId
37
     * @return void
38
     */
39
    public function disconnection($appId);
40
41
    /**
42
     * Save all the stored statistics.
43
     *
44
     * @return void
45
     */
46
    public function save();
47
48
    /**
49
     * Flush the stored statistics.
50
     *
51
     * @return void
52
     */
53
    public function flush();
54
55
    /**
56
     * Get the saved statistics.
57
     *
58
     * @return PromiseInterface[array]
0 ignored issues
show
Documentation Bug introduced by
The doc comment PromiseInterface[array] at position 1 could not be parsed: Expected ']' at position 1, but found '['.
Loading history...
59
     */
60
    public function getStatistics(): PromiseInterface;
61
62
    /**
63
     * Get the saved statistics for an app.
64
     *
65
     * @param  string|int  $appId
66
     * @return PromiseInterface[\BeyondCode\LaravelWebSockets\Statistics\Statistic|null]
0 ignored issues
show
Documentation Bug introduced by
The doc comment PromiseInterface[\Beyond...tistics\Statistic|null] at position 1 could not be parsed: Expected ']' at position 1, but found '['.
Loading history...
67
     */
68
    public function getAppStatistics($appId): PromiseInterface;
69
70
    /**
71
     * Remove all app traces from the database if no connections have been set
72
     * in the meanwhile since last save.
73
     *
74
     * @param  string|int  $appId
75
     * @return void
76
     */
77
    public function resetAppTraces($appId);
78
}
79