| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function connectAction(Request $request) |
||
| 23 | { |
||
| 24 | $pusher = $this->get('notification.pusher_manager')->getPusherClient(); |
||
| 25 | |||
| 26 | $channelName = $request->get('channel_name'); |
||
| 27 | $socketId = $request->get('socket_id'); |
||
| 28 | |||
| 29 | $pusherChannel = new PusherChannel($channelName, $socketId); |
||
| 30 | |||
| 31 | // Check if user should have access. |
||
| 32 | $this->denyAccessUnlessGranted('subscribe', $pusherChannel); |
||
| 33 | |||
| 34 | // Creates a json encoded string. |
||
| 35 | $responseBody = $pusher->socket_auth($channelName, $socketId); |
||
| 36 | |||
| 37 | return new Response( |
||
| 38 | $responseBody, |
||
| 39 | '200', |
||
| 40 | [ |
||
| 41 | 'Content-Type' => 'application/json', |
||
| 42 | ] |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |