Issues (4)

src/Application.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\React\Socket;
6
7
use Exception;
8
use Ratchet\ConnectionInterface;
9
use Ratchet\Wamp\WampServerInterface;
10
11
class Application implements WampServerInterface
12
{
13
    /**
14
     * @param string JSON'ified string we'll receive from ZeroMQ
0 ignored issues
show
Documentation Bug introduced by
The doc comment JSON'ified at position 0 could not be parsed: Unknown type name 'JSON'ified' at position 0 in JSON'ified.
Loading history...
15
     */
16
    public function notify($entry)
17
    {
18
        $entryData = json_decode($entry, true);
0 ignored issues
show
The assignment to $entryData is dead and can be removed.
Loading history...
19
    }
20
21
    public function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible): void
22
    {
23
        $topic->broadcast($event);
24
    }
25
26
    public function onCall(ConnectionInterface $conn, $id, $topic, array $params): void
27
    {
28
//        $conn->callError($id, $topic, 'RPC not supported on this demo');
29
    }
30
31
    // No need to anything, since WampServer adds and removes subscribers to Topics automatically
32
    public function onSubscribe(ConnectionInterface $conn, $topic): void
33
    {
34
    }
35
36
    public function onUnSubscribe(ConnectionInterface $conn, $topic): void
37
    {
38
39
    }
40
41
    public function onOpen(ConnectionInterface $conn): void
42
    {
43
        // Verify jwt token
44
        // Subscribe user to all required channels|events
45
        echo "onOpen\n";
46
    }
47
48
    public function onClose(ConnectionInterface $conn): void
49
    {
50
        // UnSubscribe user from channels|events
51
        echo "onClose\n";
52
    }
53
54
    public function onError(ConnectionInterface $conn, Exception $e): void
55
    {
56
        // Log error
57
        echo "onError" . $e;
58
    }
59
}
60