-
-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Labels
Description
I am sure that it worked before, but recently I found the following log in laravel.log.
local.ERROR: exception 'Sly\NotificationPusher\Exception\PushException' with message '400 Bad Request; invalid message' in /mnt/home/apache/....../vendor/sly/notification-pusher/src/Sly/NotificationPusher/Adapter/Gcm.php:72
I tested it by creating a simple program, and I confirmed that it works for iOS, meaning that the contents of the message would be OK. But I faced the same error of '400' in case of Android.
I found the following source code in the server.
public function push(PushInterface $push)
{
$client = $this->getOpenedClient();
$pushedDevices = new DeviceCollection();
$tokens = array_chunk($push->getDevices()->getTokens(), 100);
foreach ($tokens as $tokensRange) {
$message = $this->getServiceMessageFromOrigin($tokensRange, $push->getMessage());
try {
$this->response = $client->send($message);
} catch (ServiceRuntimeException $e) {
throw new PushException($e->getMessage());
}
if ((bool) $this->response->getSuccessCount()) {
foreach ($tokensRange as $token) {
$pushedDevices->add($push->getDevices()->get($token));
}
}
}
return $pushedDevices;
}The error occurred at $this->response = $client->send($message);
(When I checked the source code in GitHub, and I found that the source code is slightly different. Should I update it??)
This is my first time to open an issue in GitHub, so I am not sure how I should do...
Anyway, any information is very helpful because I am now in stuck ....
centotaure