richsage / RMSPushNotificationsBundle

NOT MAINTAINED! ⛔️ Push notifications/messages for mobile devices. Supports iOS, Android (C2DM, GCM), Blackberry and Windows Mobile (toast only). A Symfony2 bundle.
MIT License
321 stars 152 forks source link

How control status sending message? #18

Open ZhukV opened 11 years ago

ZhukV commented 11 years ago

This bundle have a problems:

  1. Can not send messages from queue. Can create a collection (ArrayObject)?
  2. Not found control status message. Can return status messages after call send()?
roman-1983 commented 9 years ago

+1

youuri commented 9 years ago

+1

MatthieuCutin commented 8 years ago

I do agree with your second point. To go around this problem really quickly i did something like that :

    public function send(MessageInterface $message)
    {
    ...

        $errorResponses = array();
        // Determine success
        foreach ($this->responses as $response) {
            $message = json_decode($response->getContent());
            if ($message === null || $message->success == 0 || $message->failure > 0) {
                if ($message == null) {
                    $this->logger->err($response->getContent());
                } else {
                    $this->logger->err($message->failure);
                }
                $errorResponses[] = $response;
            }
        }

        return $errorResponses;
    }

And in my service i browse each erroResponse content to determine why it failed.

It has to be improved to return something true in case of success or manage errors in the Bundle.