tpeczek / Lib.Net.Http.WebPush

Lib.Net.Http.WebPush is a library which provides a Web Push Protocol based client for Push Service.
MIT License
75 stars 13 forks source link

"Official" support for .NET 8 #32

Closed dannybucks closed 1 week ago

dannybucks commented 1 month ago

I upgraded to .NET 8 and Lib.Net.Http.WebPush and Lib.AspNetCore.WebPush works well! However, according to the NuGet Gallary it does not officiall support .NET 8: https://www.nuget.org/packages/Lib.AspNetCore.WebPush#dependencies-body-tab Are there any plans to upgrade officially?

A notice: Function Apps: InProcess Function Apps won't be supported from end of 2026. The new thing is isolated Function Apps and these no longer use WebJobs, so your Function App WebPush project needs some ajustments to. I found, that the official upgrade guide suggests to add Microsoft.AspNetCore.App: https://learn.microsoft.com/en-us/azure/azure-functions/migrate-dotnet-to-isolated-model?tabs=net8 I'm using your library in a Function App and was able to use the normal Lib.AspNetCore.WebPush by adding

services.AddPushServiceClient(options => { IConfigurationSection pushNotificationServiceConfigurationSection = configuration.GetSection(nameof(PushServiceClient));

            options.Subject = pushNotificationServiceConfigurationSection.GetValue<string>(nameof(options.Subject));
            options.PublicKey = pushNotificationServiceConfigurationSection.GetValue<string>(nameof(options.PublicKey));
            options.PrivateKey = pushNotificationServiceConfigurationSection.GetValue<string>(nameof(options.PrivateKey));
        });

to the Program (isolated Function Apps no longer use a Startup class) and everythings worked great.

So, it seems, this is only a matter of documentation.

tpeczek commented 1 month ago

Hi @dannybucks,

Thank you for reaching out (and using my stuff 😉).

Regarding the .NET 8 "official" support, my approach based from past experiences from this and my other libraries is to add the new framework version to the test suite (this has been done here: https://github.com/tpeczek/Lib.Net.Http.WebPush/commit/5f91cf5fb2f563f93e5e6c2b90ef8f005ac42f2c). If there are issues, I fix them and release a new version. If there are no issues, I include the new target framework with the next release that is bringing any actual changes to the library (and I didn't had a reason to release new version of this library past year). I do it like this, because I have learned that releases with only new target frameworks are causing confusion to many consumer and in fact doesn't bring any significant value. Also NuGet does list the new target frameworks as officially compatible under the Frameworks tab (https://www.nuget.org/packages/Lib.AspNetCore.WebPush#supportedframeworks-body-tab).

The Functions App subject is a little bit more tricky. Simple answer is that I haven't made my mind about what to do with it yet. To provide the same level of support for the isolated worker model as I currently provide for the in-process model, I should create a dedicated isolated worker model extension (https://www.tpeczek.com/2024/03/azure-functions-extensibility.html) as I did for one of my other libraries (https://github.com/tpeczek/dotnet-server-timing). The trick is, that I haven't determined if there is a demand for it (as you have noticed, the functionality can be achieved without the extension). At this point I've decided to create some issues to track the effort, but they are not a declaration that I will certainly go that path 😉 (happy to get to know your thoughts):