Support WebSockets over HTTP/2 via RFC 8441 Extended CONNECT
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- scala
- Lĩnh vực
- api, backend, networking
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các API WebSocketUpgrade và handleWebSocketMessages hiện có, sau đó lần theo cách xử lý HTTP/2 theo RFC 8441. Xác định cách SETTINGS_ENABLE_CONNECT_PROTOCOL, Extended CONNECT, HTTP/2 status 200, luồng frame và việc kết thúc stream sẽ tích hợp với ngăn xếp thông điệp WebSocket hiện có. Hoàn tất nghĩa là đã thống nhất API và hành vi phía máy chủ, với độ bao phủ cho các stream WebSocket HTTP/2 được chấp nhận và đã kết thúc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Pekko HTTP supports HTTP/2 and WebSockets, but WebSocket support currently appears to be limited to the classic HTTP/1.1 upgrade handshake.
RFC 8441 defines how to bootstrap WebSockets over HTTP/2 using Extended CONNECT:
- server advertises
SETTINGS_ENABLE_CONNECT_PROTOCOL = 1 - client sends
:method = CONNECT - client sends
:protocol = websocket - request also includes
:scheme,:path, and:authority - server accepts with
:status = 200 - WebSocket frames are then carried over the HTTP/2 stream
This would allow applications to serve HTTP/2 requests and WebSockets on the same HTTP/2 connection instead of falling back to a separate HTTP/1.1 WebSocket upgrade connection.
RFC: https://www.rfc-editor.org/rfc/rfc8441.html
Current Behavior
Pekko HTTP WebSocket handling is based on the HTTP/1.1 upgrade model:
- request validation expects
Upgrade: websocket,Connection: Upgrade,Sec-WebSocket-Key, andSec-WebSocket-Version - accepted WebSockets return
101 Switching Protocols - the existing
WebSocketUpgradeAPI represents upgrading the connection to WebSocket
That matches RFC 6455 over HTTP/1.1, but not RFC 8441 over HTTP/2.
Expected Behavior
When HTTP/2 is enabled, Pekko HTTP should optionally support RFC 8441 WebSockets over HTTP/2.
At a high level this likely means:
- advertise
SETTINGS_ENABLE_CONNECT_PROTOCOL = 1when server-side support is enabled - accept HTTP/2 Extended CONNECT requests with
:protocol = websocket - expose those requests to routing / low-level APIs similarly to existing WebSocket upgrade requests
- allow existing
handleWebSocketMessages/WebSocketUpgradestyle APIs to work where practical - respond with HTTP/2
:status = 200when the WebSocket is accepted - connect the existing WebSocket frame/message stack to the HTTP/2 stream DATA flow
- map HTTP/2 stream end/reset/failure semantics sensibly to WebSocket close behavior
Motivation
Modern browsers support WebSockets over HTTP/2 via RFC 8441. Supporting this in Pekko HTTP would allow one server port and one HTTP/2 connection to handle both normal HTTP traffic and WebSockets.
This is useful for frameworks built on Pekko HTTP as well. For example, Play Framework can enable HTTP/2 on its Pekko HTTP backend, but WebSocket support still depends on the HTTP/1.1 upgrade path because Pekko HTTP does not currently expose RFC 8441 WebSocket support.
Notes
Netty has already added several low-level RFC 8441 building blocks, but still tracks high-level WebSocket-over-HTTP/2 support as an open feature request:
- https://github.com/netty/netty/issues/8011
- https://github.com/netty/netty/issues/12352
- https://github.com/netty/netty/pull/11192
- https://github.com/netty/netty/pull/14995
- https://github.com/netty/netty/pull/15312
- https://github.com/netty/netty/pull/16932
A third-party Netty implementation also exists:
Questions
- Would the Pekko HTTP project be open to RFC 8441 server-side support?
- Should this be implemented behind an explicit config flag, for example under
pekko.http.server.websocketorpekko.http.server.http2? - Should the existing
WebSocketUpgradeAPI be reused for HTTP/2 Extended CONNECT, or should there be a separate API to distinguish HTTP/1.1 upgrade from HTTP/2 stream-based WebSocket bootstrap?
- Ngôn ngữ chính
- Scala
- Star
- 196
- Fork
- 56
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 43
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/pekko-http
-
dependencies
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
apache/pekko-http#1354 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
apache/pekko-http#1273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HTTP/2 client ALPN fallback needs a handshake-complete signal that the TLS stage does not emitĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
apache/pekko-http#1249 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
apache/pekko-http#1248 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
apache/pekko-http#1180 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/pekko-http
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ergoplatform/ergo#2736 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:shuffle enhancement good first issue performance requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7072 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug 🐞 CI/CD ⚒️
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
valkey-io/valkey-glide#7370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Improve UI text on confirmation page (at registration)Có thể đã có người làm @Arghyann đã nhận hôm nay. Đang mởgood first issue improvement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
lichess-org/lila#22126 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[VL] Remove the unused ShuffleSchema.hCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày