Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PushServiceClientException with StatusCode.OK when sending message to Firefox on Android endpoint #36

Closed
SeeWhat opened this issue Oct 22, 2024 · 1 comment · Fixed by #37
Assignees

Comments

@SeeWhat
Copy link

SeeWhat commented Oct 22, 2024

Description

When sending a message to an endpoint registered by Firefox on Android an exception is incorrectly thrown.

Reproduction Steps

Using Firefox on Android (tested with 131.0.3), register for push notifications.
Send a push notification to the registered endpoint.

Expected behavior

The mesage is received and no exception occurs.

Actual behavior

The mesage is received but a PushServiceClientException is thrown with no Body and a HttpStatusCode of OK (200)

Possibly cause

It seems the below line, should check for either HttpStatusCode.Created or HttpStatusCode.OK before throwing an exception.

if (pushMessageDeliveryRequestResponse.StatusCode == HttpStatusCode.Created)

@tpeczek
Copy link
Owner

tpeczek commented Oct 22, 2024

I did some digging and it looks like Mozilla Autopush Server is implementing an older (expired) version of WebPush specification (at least this is what they are referring to in their docs: https://mozilla-services.github.io/autopush-rs/http.html#send-notification). That older version wasn't too specific about return codes:

A simple 200 response is sufficient to indicate that the push message was accepted. This does not indicate that the message was delivered to the user agent.

The current version is a little bit more specific:

A 201 (Created) response indicates that the push message was accepted.

That said, it doesn't seem to forbid other statuses, which means that what Mozilla Autopush Server is doing (returning 202
when message will be delivered at a later time and 200 when message has been delivered to node client is connected to) is valid.

I will adjust the implementation to consider all three (200, 201, and 202) as success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants