Conditions | 1 |
Paths | 1 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function connectAction(Request $request) |
||
16 | { |
||
17 | $pusher = $this->get('notification.pusher_manager')->getPusherClient(); |
||
18 | |||
19 | $channelName = $request->get('channel_name'); |
||
20 | $socketId = $request->get('socket_id'); |
||
21 | |||
22 | $pusherChannel = new PusherChannel($channelName, $socketId); |
||
23 | |||
24 | // Check if user should has access to the pusher channel. |
||
25 | $this->denyAccessUnlessGranted('subscribe', $pusherChannel); |
||
26 | |||
27 | // Creates a JSON encoded string. |
||
28 | $responseBody = $pusher->socket_auth($channelName, $socketId); |
||
29 | |||
30 | return new Response( |
||
31 | $responseBody, |
||
32 | '200', |
||
33 | [ |
||
34 | 'Content-Type' => 'application/json', |
||
35 | ] |
||
36 | ); |
||
37 | } |
||
38 | } |
||
39 |