[go: nahoru, domu]

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

feat(fcm): Add HTTP2 support for sendEach() and sendEachForMulticast() #2550

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jonathanedey
Copy link
Contributor
@jonathanedey jonathanedey commented May 9, 2024

Added:

  • HTTP/2 support for sendEach() and sendEachForMulitcast()
  • New deprecated method enableLegacyTransport()

When sending messages using sendEach() or sendEachForMulitcast() a HTTP/2 connection is now used by default.

In order to use the legacy HTTP/1.1 versions of these methods, the enableLegacyTransport() method must be used. This method is already marked as deprecated and will be removed once the HTTP/2 transport is considered fully stable.

Related: #2488

@jonathanedey jonathanedey added the release:stage Stage a release candidate label May 9, 2024
@jonathanedey jonathanedey changed the title feat: Add HTTP2 support for sendEach() and sendEachForMulticast feat: Add HTTP2 support for sendEach() and sendEachForMulticast() May 10, 2024
@jonathanedey jonathanedey marked this pull request as ready for review May 10, 2024 19:28
test/unit/utils/api-request.spec.ts Dismissed Show dismissed Hide dismissed
test/unit/utils/api-request.spec.ts Dismissed Show dismissed Hide dismissed
test/unit/utils/api-request.spec.ts Dismissed Show dismissed Hide dismissed
test/unit/utils/api-request.spec.ts Dismissed Show dismissed Hide dismissed
Copy link
Member
@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Jonathan!
The first pass (to quickly unblock you) LGTM. I will take another look at the tests.
Let's get an internal API proposal going soon

@lahirumaramba lahirumaramba changed the title feat: Add HTTP2 support for sendEach() and sendEachForMulticast() feat(fcm): Add HTTP2 support for sendEach() and sendEachForMulticast() May 30, 2024
@lahirumaramba
Copy link
Member

Thanks Jonathan! Let's make the changes we discussed in the API proposal and do another pass. We should be good to go then!

* ```
*
* @deprecated This is to be removed once the HTTP/2 transport is universally safe.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a TW review on this?

* messaging.sendEach(messages);
* ```
*
* @deprecated This is to be removed once the HTTP/2 transport is universally safe.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to be removed once the HTTP/2 transport implementation is universally safe. ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not crazy about that wording either. Can we give a more concrete criteria than safety?

Copy link
Contributor
@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG! But I do have comments :)

Can you use your eagle eye and do a scrub for literals that lack backticks Lahiru? Thanks!

@@ -221,6 +223,22 @@ export class Messaging {
return this.appInternal;
}

/**
* Enables the use of the legacy HTTP/1.1 transport for sendEach() and sendEachForMulticast().
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "layer," as in "the x transport layer?"

Let's do either that or drop the "the," with backticks like:

"Enables the use of legacy HTTP/1.1 transport for sendEach() and sendEachForMulticast().

* messaging.sendEach(messages);
* ```
*
* @deprecated This is to be removed once the HTTP/2 transport is universally safe.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not crazy about that wording either. Can we give a more concrete criteria than safety?

* Default retry configuration for HTTP requests. Retries up to 4 times on connection reset and timeout errors
* as well as HTTP 503 errors. Exposed as a function to ensure that every HttpClient gets its own RetryConfig
* Default retry configuration for HTTP and HTTP/2 requests. Retries up to 4 times on connection reset and timeout
* errors as well as 503 errors. Exposed as a function to ensure that every RequestClient gets its own RetryConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's backtick these literals.

}

/**
* Sends an HTTP request to a remote server. If the server responds with a successful response (2xx), the returned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are literals in this long comment that need backticks.

* Sends an HTTP request to a remote server. If the server responds with a successful response (2xx), the returned
* promise resolves with an RequestResponse. If the server responds with an error (3xx, 4xx, 5xx), the promise rejects
* with an RequestResponseError. In case of all other errors, the promise rejects with a FirebaseAppError. If a
* request fails due to a low-level network error, transparently retries the request once before rejecting the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's provide a subject noun here -- what entity retries? The server/backend/promise?

* Sends an HTTP/2 request to a remote server. If the server responds with a successful response (2xx), the returned
* promise resolves with an RequestResponse. If the server responds with an error (3xx, 4xx, 5xx), the promise rejects
* with an RequestResponseError. In case of all other errors, the promise rejects with a FirebaseAppError. If a
* request fails due to a low-level network error, transparently retries the request once before rejecting the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subject here too please, thanks!


constructor(private readonly config: HttpRequestConfig) {
/**
* An adapter class with common functionality needed to extract options and entity data from a RequestConfig.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a literal.

// GET and HEAD requests do not support entity (body) in request.
return this.method !== 'GET' && this.method !== 'HEAD';
}
}

/**
* An adapter class for extracting options and entity data from an HttpRequestConfig.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another literal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:stage Stage a release candidate release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants