if ($sub = APNSSubscriber::create()) {
     $route = $_REQUEST['route'];
     $params = Array(
       'route_id' => $route,
       'stop_id' => $_REQUEST['stop'],
       );

     // unsubscribe any existing subscriptions for the same route/stop
     if ($sub->unsubscribe("ShuttleSubscription", $params) && $command == 'unsubscribe') {
       $data = Array('success' => $command);

     } else {
       $request_time = isset($_REQUEST['time']) ? $_REQUEST['time'] : time();

       $interval = ShuttleSchedule::get_interval($route);
       if (($numshuttles = ShuttleSchedule::count_shuttles_running($route, $request_time)) > 1) {
	 $interval /= $numshuttles;
       }

       $start_time = $request_time - intval($interval / 2);
       $expire_time = $start_time + intval($interval * 1.5);

       $params['start_time'] = $start_time;
       if ($sub->subscribe("ShuttleSubscription", $params))
	 $data = Array('success' => $command,
		       'start_time' => $start_time,
		       'expire_time' => $expire_time);
     }
   }
   break;
}