mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 07:11:42 +09:00
알림 기능 구현FCM은 테스트 완료
This commit is contained in:
parent
07e28b4ef9
commit
347152e163
9 changed files with 127 additions and 55 deletions
|
|
@ -42,11 +42,14 @@ class APNs extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
|||
*
|
||||
* @param object $message
|
||||
* @param array $tokens
|
||||
* @return bool
|
||||
* @return object
|
||||
*/
|
||||
public function send(\Rhymix\Framework\Push $message, array $tokens): bool
|
||||
public function send(\Rhymix\Framework\Push $message, array $tokens)
|
||||
{
|
||||
$status = true;
|
||||
$output = new \stdClass;
|
||||
$output->success = [];
|
||||
$output->invalid = [];
|
||||
$output->needUpdate = [];
|
||||
|
||||
// Set parameters
|
||||
$local_cert = $this->_config['certificate'];
|
||||
|
|
@ -68,18 +71,17 @@ class APNs extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
|||
if(!$fp)
|
||||
{
|
||||
$message->addError('Failed to connect socket - error code: '. $err .' - '. $errstr);
|
||||
$status = false;
|
||||
}
|
||||
$msg = chr(0) . pack('n', 32) . pack('H*', $token) . pack('n', strlen($payload)) . $payload;
|
||||
$result = fwrite($fp, $msg, strlen($msg));
|
||||
if(!$result)
|
||||
{
|
||||
$message->addError('APNs return empty response.');
|
||||
$status = false;
|
||||
}
|
||||
$output->success[] = $token;
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
return $status;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue