Closed uqutub closed 8 years ago
Hi, uqutub.
PushMessageData
is a special interface to interact with a payload. There are several methods for a data extraction. For example PushMessageData.json()
.
You can find more here https://developer.mozilla.org/ru/docs/Web/API/PushMessageData
thanks. will check this out.
but this sendWebPush function takes first parrameter as message and then encrypt it and set to the body property, but when it is sending and get resloved callback it shows body empty, not getting message on client side in data.
I'm facing the same problem. Body is empty
it is resolved,
actually the issue is in all documentation we have read to get data from event by event.data.json() but it gives error, we have get data from event.data.text();
thanks .
From Server am using: webpush.sendWebPush('my push messsage', subscription).then(function(resolve,reject){ console.log('chrome resolve: ', resolve); console.log('chrome reject: ', reject); });
result of resolve: { statusCode: 201, statusMessage: 'Created', body: '' }
on client getting push event: {data: PushMessageData, type: "push", target: ServiceWorkerGlobalScope, currentTarget: ServiceWorkerGlobalScope, eventPhase: 2…}
i always found empty object: PushMessageData {}