Prohledat stránky podpory

Vyhněte se podvodům. Za účelem poskytnutí podpory vás nikdy nežádáme, abyste zavolali nebo poslali SMS na nějaké telefonní číslo nebo abyste sdělili své osobní údaje. Jakékoliv podezřelé chování nám prosím nahlaste pomocí odkazu „Nahlásit zneužití“.

Learn More

Web Push C# server example

  • 1 odpověď
  • 1 má tento problém
  • 21 zobrazení
  • Poslední odpověď od Paul

more options

With Firefox 44+ now supporting the Push API (and that Edge developers have also committed to supporting it) does someone have some example C# code that would be able to encrypt then push a payload-bearing message to my Firefox Web App?

If you are unfamiliar with what is required then basically, once your Javascript client has registered its Service Worker it can then register with the PushManager flagging its willingness to accept Notifications. You then (Firefox only at the moment Chrome is fixing a bug) call getKey() on your subscription object and send the result along with your subscription .endpoint to your server so that your server logic knows that you have subscribed. (E.g. https://github.com/chrisdavidmills/push-api-demo/blob/gh-pages/main.js#L19 )

Ok, that's all on the browser and not particularly relevant to the C# code. What I'mm looking for is C# that will take the public key DH 'p256dh' and use it to encrypt the response message (avec payload) that will be POSTed back to the browser.

The only server example I have is Javascript NODE.js etc stuff: - https://github.com/marco-c/web-push/blob/master/index.js if you look at the encrypt() function or, for a complete picture the sendNotification() function, you will see the encryption and the pushRequest I'm looking for.

Is there a class(es) that handles this for us in .NET C#

With Firefox 44+ now supporting the Push API (and that Edge developers have also committed to supporting it) does someone have some example C# code that would be able to encrypt then push a payload-bearing message to my Firefox Web App? If you are unfamiliar with what is required then basically, once your Javascript client has registered its Service Worker it can then register with the PushManager flagging its willingness to accept Notifications. You then (Firefox only at the moment Chrome is fixing a bug) call getKey() on your subscription object and send the result along with your subscription .endpoint to your server so that your server logic knows that you have subscribed. (E.g. https://github.com/chrisdavidmills/push-api-demo/blob/gh-pages/main.js#L19 ) Ok, that's all on the browser and not particularly relevant to the C# code. What I'mm looking for is C# that will take the public key DH 'p256dh' and use it to encrypt the response message (avec payload) that will be POSTed back to the browser. The only server example I have is Javascript NODE.js etc stuff: - https://github.com/marco-c/web-push/blob/master/index.js if you look at the encrypt() function or, for a complete picture the sendNotification() function, you will see the encryption and the pushRequest I'm looking for. Is there a class(es) that handles this for us in .NET C#

Všechny odpovědi (1)

more options

Hi

Thank you for your question, but this forum is more for the answering of front end user issues rather than programming support.

I recommend that you ask your question in the Stack Overflow community.