public function send($data, array $registrationIds = [], array $options = [])
    {
        $this->responses = [];

        $data = array_merge($options, [
            'data' => $data,
        ]);

        if (isset($options['to'])) {
            $this->responses[] = $this->browser->post($this->apiUrl, $this->getHeaders(), json_encode($data));
        } elseif (count($registrationIds) > 0) {
            // Chunk number of registration ID's according to the maximum allowed by GCM
            $chunks = array_chunk($registrationIds, $this->registrationIdMaxCount);
            // Perform the calls (in parallel)
            foreach ($chunks as $registrationIds) {
                $data['registration_ids'] = $registrationIds;
                $this->responses[] = $this->browser->post($this->apiUrl, $this->getHeaders(), json_encode($data));
            }
        }

        $this->client->flush();

        foreach ($this->responses as $response) {
            $message = json_decode($response->getContent());
            if ($message === null || $message->success == 0 || $message->failure > 0) {
                return false;
            }
        }

        return true;
    }