Subscriber

A default subscriber implementation that can be used to decode subscriptions encoded by client-side JavaScript directly.

Subscriber.swift:138
struct Subscriber

Note that this object requires the VAPID key (applicationServerKey in JavaScript) that was supplied during registration, which is not provided by default by PushSubscription.toJSON():

const subscriptionStatusResponse = await fetch(`/registerSubscription`, {
    method: "POST",
    body: {
        ...subscription.toJSON(),
        applicationServerKey: subscription.options.applicationServerKey,
    }
});

If you cannot provide this for whatever reason, opt to decode the object using your own type, and conform to SubscriberProtocol instead.