important question subscription keys

Open
#663 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 13 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
web-dev

Research direction

Start with the PushUsers server handler and the sendSubscription function shown in the issue, then inspect the surrounding sample and its existing documentation. Clarify whether the sample should explain the subscription object's keys and how to inspect them; done means the question has a documented, reproducible answer.

Written by the indexing model from the issue text.

Description

I have such code on the server. It logs user keys for subscribing service wokers to the server.

exports.PushUsers = (req,res) =>{
const subscription = req.body

console.log("ITSKEY",subscription.keys.p256dh )

On the external interface there is code that is responsible for subscribing to the push notification server.

function sendSubscription(subscription) {
return fetch(${process.env.REACT_APP_API_URL}/push/user/, {
method: 'POST',
body: JSON.stringify(subscription),
headers: {
'Content-Type': 'application/json'
}
})
}

Can I find out what subscriptions user has subscription.keys?

P.S. I tried to log the subscription object. But there are no keys in it. Apparently, the mechanics of their formation are encapsulated.

Dominant language
JavaScript
Stars
5.9k
Forks
2.4k
Avg merge
12d 12h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GoogleChrome/samples

All issues in GoogleChrome/samples

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.