diff --git a/src/ApnChannel.php b/src/ApnChannel.php index 45c0789..f18e6fb 100644 --- a/src/ApnChannel.php +++ b/src/ApnChannel.php @@ -107,6 +107,9 @@ public function send($notifiable, Notification $notification) 'error' => $response->getCode(), ]) ); + //connection is useless so create a new connection + $this->closeConnection(); + $this->openConnection(); } } catch (Exception $e) { throw SendingFailed::create($e); diff --git a/tests/ApnChannelTest.php b/tests/ApnChannelTest.php index 4ac3480..a35862f 100644 --- a/tests/ApnChannelTest.php +++ b/tests/ApnChannelTest.php @@ -2,14 +2,14 @@ namespace NotificationChannels\Gcm\Test; +use Mockery; +use PHPUnit_Framework_TestCase; use Illuminate\Events\Dispatcher; use Illuminate\Notifications\Notifiable; use NotificationChannels\Apn\ApnChannel; -use Illuminate\Notifications\Notification; -use NotificationChannels\Apn\ApnFeedback; use NotificationChannels\Apn\ApnMessage; -use PHPUnit_Framework_TestCase; -use Mockery; +use NotificationChannels\Apn\ApnFeedback; +use Illuminate\Notifications\Notification; use ZendService\Apple\Apns\Client\Message as Client; use ZendService\Apple\Apns\Client\Feedback as FeedbackClient; use ZendService\Apple\Apns\Response\Message as MessageResponse;