Skip to content

transport-module/http2 protocol support using package:http2 for io#150

Open
mohitpubnub wants to merge 10 commits into
masterfrom
CLEN-3407
Open

transport-module/http2 protocol support using package:http2 for io#150
mohitpubnub wants to merge 10 commits into
masterfrom
CLEN-3407

Conversation

@mohitpubnub

@mohitpubnub mohitpubnub commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

feat(networking-module): added support for h2 protocol using http2 package.

added support for h2 protocol using http2 package.

BREAKING CHANGES: Required minimum dart sdk version is 3.2.0/flutter 3.16.x

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 duplication

Metric Results
Duplication 7

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…beat interval. recommended way to provide heartbeat interval is via presence endpoint.
@mohitpubnub mohitpubnub self-assigned this Jun 26, 2026

// Origin does not support HTTP/2 — fall back to HTTP/1.1 for this request.
if (h2 == null) {
return _responseViaHttp1(data, currentUri, currentHeaders, currentBody);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

_responseViaHttp1 will override existing timer under _sendTimeoutTimer without its cancellation. Shouldn't you cancel any existing timer before the fallback?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes. Here, The orphaned h2-path timer stays live until it fires. Because both timers use the same sendTimeout duration and the h2 timer started earlier (it includes the ALPN-probe time), it fires first — so on a slow request it could trip the timeout slightly early, and in all cases it keeps a live Timer + closure around needlessly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

required changes applied d78c201

/// keep-alive timers. Optional to call — idle connections are otherwise
/// reaped automatically — but useful for a deterministic shutdown. No-op on
/// the web platform.
void dispose() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this method used? I see that top-level PubNub class has a dispose() method, but it does not forward a call here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems Call from PubNub.dispose() in default.dart not calling dispose of Networking module.
It should PubNub.dispose() → NetworkingModule.dispose() → disposeTransport(this) → disposeHttp2Manager(module), which closes pooled connections and cancels their keep-alive/idle timers. On web/stub, disposeTransport remains a no-op.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed applied acd4cce

@mohitpubnub

Copy link
Copy Markdown
Contributor Author

@pubnub-release-bot release dart as v8.0.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants