/**
  * Handle the event.
  *
  * @param FootballMatchUpdated  $event
  * @return mixed
  */
 public function handle(FootballMatchUpdated $event)
 {
     if ($event->match) {
         $match = $this->api->live();
         $this->pusher->trigger('live-match', 'new-match', ['match' => $match->getData()]);
     }
 }
예제 #2
0
 /**
  * Generate Pusher authentication token for currently logged user.
  *
  * @param  Request $request
  * @param  PusherManager $pusher
  *
  * @return string
  */
 public function authenticatePusher(Request $request, PusherManager $pusher)
 {
     $channelName = 'private-u-' . auth()->id();
     $socketId = $request->input('socket_id');
     $pusher->connection();
     return $pusher->socket_auth($channelName, $socketId);
 }
예제 #3
0
 /**
  * Handle the server was poked event.
  *
  * @param ServerWasPoked $event
  *
  * @return void
  */
 public function handle(ServerWasPoked $event)
 {
     $channel = env('PUSHER_CHANNEL', 'pi-finder');
     $device = $event->getDevice();
     if ($device->isPublic()) {
         $this->pusher->trigger($channel, 'ServerWasPoked', ['device' => $this->transformer->transform($device)]);
     } else {
         $channel = $channel . '-' . $device->group;
         $this->pusher->trigger($channel, 'ServerWasPoked', ['device' => $this->transformer->transform($device)]);
     }
 }
예제 #4
0
 public function deleted($device)
 {
     $this->pusher->trigger(env('PUSHER_CHANNEL', 'pi-finder'), 'DeviceWasDeleted', ['device' => $this->transformer->transform($device)]);
 }
예제 #5
0
 public function changeTrack(Request $request)
 {
     if (isset($request->id)) {
         $this->pusher->trigger('playlist-channel', 'track-changed', ['id' => $request->id]);
     }
 }
예제 #6
0
 public function push(PusherManager $pusher)
 {
     $message = 'Hello world' + rand(0, 1000);
     $pusher->trigger('test-channel', 'new-message', ['message' => $message]);
 }