Polly is a powerful library for .NET that helps you handle transient faults and improve the resilience of your applications.
using Polly;
using System.Net;| public class AppLogger<T> : IAppLogger<T> where T : class | |
| { | |
| private readonly ILogger<T> _logger; | |
| public AppLogger(ILogger<T> logger) | |
| { | |
| _logger = logger; | |
| } |
| using TestingPractice.Services; | |
| namespace TestingPractice | |
| { | |
| public class Program | |
| { | |
| public static void Main(string[] args) | |
| { | |
| var builder = WebApplication.CreateBuilder(args); |
| using APIDocsRider.DB; | |
| using Microsoft.Data.SqlClient; | |
| using Microsoft.EntityFrameworkCore; | |
| namespace APIDocsRider.BL; | |
| public class WorkerService(ILogger<WorkerService> logger, IServiceProvider serviceProvider) : BackgroundService | |
| { | |
| private readonly IServiceProvider _serviceProvider = serviceProvider; | |
| private readonly ILogger<WorkerService> _logger = logger; |
| namespace AMQSubscriberWorker.Services | |
| { | |
| public interface IOrderService | |
| { | |
| PizzaOrder? DeserializeOrder(string pizzaOrder); | |
| } | |
| } |
This example demonstrates how to handle browser push notifications using vanilla HTML & JavaScript via Web Push API. WebPush API sends messages from the server (backend) to the client (browser/mobile phone). The API uses HTTP2 protocol which requires HTTPS connection (unless you're in localhost) The server sends messages to the client's browser via Firebase Cloud Messaging API (or FCM for short).