benwilkins / laravel-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel
MIT License
213 stars 91 forks source link

cURL errors during notification sending #44

Open kalizi opened 5 years ago

kalizi commented 5 years ago

Sometimes I unexpectly got two cURL errors

Here's my code:

class WelcomeNotification extends Notification {
    public function via($notifiable) {
        return ['fcm'];
    }
    public function toFcm($notifiable) {
        $message = new FcmMessage();

        $message
            ->content([
                'title' => 'Welcome to MyApp',
                'body' => 'Hi there, and welcome to MyApp!',
                'sound' => true,
            ])
            ->data(array('welcome' => true, 'test' => 1))
            ->priority(FcmMessage::PRIORITY_HIGH);

        return $message;
    }
}

On the user class I have:

public function routeNotificationForFcm($notification) {
    return $this->fcm_device_id;
}

On tinker I just take a user $user = User::first(); and send a notification $user->notifyNow( new WelcomeNotification() );

First time, notification get sent. Then I wait some minutes, and retry $user->notifyNow( new WelcomeNotification() );

I got two different errors during the second sending (the errors spawn randomically), first is:

GuzzleHttp/Exception/ConnectException with message 'cURL error 35: Bulk data encryption algorithm failed in selected cipher suite. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'

Second is:

GuzzleHttp/Exception/ConnectException with message 'cURL error 35: A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'