forked from MaksimKiselev/yii2-broadcasting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogBroadcaster.php
42 lines (33 loc) · 840 Bytes
/
LogBroadcaster.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace le0m\broadcasting\broadcasters;
use Yii;
/**
* Broadcaster implementation that sends messages to log targets.
*
* @author Maksim Kiselev <maks280795@yandex.ru>
*/
class LogBroadcaster
{
/**
* {@inheritdoc}
*/
public function auth($user, $channelName)
{
}
/**
* {@inheritdoc}
*/
public function validAuthenticationResponse($user, $result)
{
}
/**
* {@inheritdoc}
*/
public function broadcast(array $channels, $event, array $payload = [])
{
$channels = implode(', ', $this->formatChannels($channels));
$payload = json_encode($payload, JSON_PRETTY_PRINT);
$message = 'Broadcasting [' . $event . '] on channels [' . $channels . '] with payload:' . PHP_EOL . $payload;
Yii::info($message, __METHOD__);
}
}