RMSPushNotificationsBundle icon indicating copy to clipboard operation
RMSPushNotificationsBundle copied to clipboard

How control status sending message?

Open ZhukV opened this issue 12 years ago • 3 comments

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()?

ZhukV avatar Dec 23 '12 09:12 ZhukV

+1

roman-1983 avatar Jun 25 '15 14:06 roman-1983

+1

youuri avatar Nov 05 '15 15:11 youuri

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.

MatthieuCutin avatar Mar 25 '16 14:03 MatthieuCutin