4xx responses from a web push server instantly deletes the subscription
If there's a configuration error or any other problem with the push server we just delete the subscription and the user has no feedback about it. There's no way to recover from it except to log out from the app and log back in.
How should we approach this?
Soft disable? Keep a count of failures? Ignore them completely?
def push_message(body, sub, api_key, subscription) do
case WebPushEncryption.send_web_push(body, sub, api_key) do
{:ok, %{status: code}} when code in 400..499 ->
Logger.debug("Removing subscription record")
Repo.delete!(subscription)
:ok