Sending notification via GCM
$msg = array( 'title' => 'This is a title. title', 'message' => 'here is a message. message', ); $fields = array( 'registration_ids' => $r, 'data' => $msg, ); $headers = array( 'Authorization: key=' . $gcm_auth_key, 'Content-Type: application/json', ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send'); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); $result = curl_exec($ch); curl_close($ch); Everything is sent successfully, I accept the message in the service worker for example https://developer.mozilla.org/ru/docs/Web/API/PushEvent
self.addEventListener('push', function(event) { console.log(event); }); The problem is that in the example the data is taken from event.data and I get event.data = null
What could be the reason and how to get the message text inside self.addEventListener ('push'
thank