/** * Send a Notification * * @param NotificationInterface $notification * * @return void */ public function sendNotification(NotificationInterface $notification) { $uri = $notification->buildUri($this->endpoint, $this->hubPath) . self::API_VERSION; $token = $this->generateSasToken($uri); $headers = array_merge(array('Authorization: ' . $token), $notification->getHeaders()); $this->request(self::METHOD_POST, $uri, $headers, $notification->getPayload()); }
/** * Send a Notification with device token * * @param NotificationInterface $notification * * @return void */ public function sendNotificationWithToken(NotificationInterface $notification) { // $uri = $notification->buildUri($this->endpoint, $this->hubPath). '?direct&api-version=2015-01'; $uri = $notification->buildUri($this->endpoint, $this->hubPath) . '?direct' . self::API_VERSION; $token = $this->generateSasToken($uri); $headers = array_merge(['Authorization: ' . $token, 'ServiceBusNotification-DeviceHandle: ' . $notification->getToken()], $notification->getHeaders()); $this->request(self::METHOD_POST, $uri, $headers, $notification->getPayload()); }