1 | <?php |
||
8 | class ConnectionEvent extends Event |
||
9 | { |
||
10 | /** |
||
11 | * This event is dispatched when a websocket connection opens. |
||
12 | * The listener will receive an instance of `ConnectionEvent`. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | const ON_OPEN = 'websocket_connection.on_open'; |
||
17 | |||
18 | /** |
||
19 | * This event is dispatched when a websocket connection closes. |
||
20 | * The listener will receive an instance of `ConnectionEvent`. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | const ON_CLOSE = 'websocket_connection.on_close'; |
||
25 | |||
26 | /** |
||
27 | * This event is dispatched when a websocket has been authenticated, |
||
28 | * and an user instance is available. |
||
29 | * The listener will receive an instance of `WebsocketAuthenticationEvent`. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | const ON_AUTHENTICATION = 'websocket_connection.on_authentication'; |
||
34 | |||
35 | /** |
||
36 | * This event is dispatched when an exception occurs during a websocket connection. |
||
37 | * The listener will receive an instance of `ConnectionErrorEvent`. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | const ON_ERROR = 'websocket_connection.on_error'; |
||
42 | |||
43 | /** |
||
44 | * This event is dispatched when someone subscribes to a wamp topic. |
||
45 | * The listener will receive an instance of `WampEvent`. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | const ON_SUBSCRIBE = 'websocket_connection.on_subscribe'; |
||
50 | |||
51 | /** |
||
52 | * This event is dispatched when someone unsubscribes to a wamp topic. |
||
53 | * The listener will receive an instance of `WampEvent`. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | const ON_UNSUBSCRIBE = 'websocket_connection.on_unsubscribe'; |
||
58 | |||
59 | /** |
||
60 | * This event is dispatched when someone publishes a message to a wamp topic. |
||
61 | * The listener will receive an instance of `PublishEvent`. |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | const ON_PUBLISH = 'websocket_connection.on_publish'; |
||
66 | |||
67 | /** |
||
68 | * This event is dispatched on remote procedure call. |
||
69 | * The listener will receive an instance of `RPCEvent`. |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | const ON_RPC = 'websocket_connection.on_rpc'; |
||
74 | |||
75 | /** |
||
76 | * @var ConnectionInterface |
||
77 | */ |
||
78 | private $conn; |
||
79 | |||
80 | /** |
||
81 | * @param ConnectionInterface $conn |
||
82 | */ |
||
83 | public function __construct(ConnectionInterface $conn) |
||
87 | |||
88 | /** |
||
89 | * @return ConnectionInterface |
||
90 | */ |
||
91 | public function getConn() |
||
95 | } |
||
96 |