Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Support WebSockets over HTTP/2 via RFC 8441 Extended CONNECT

オープン
#1,112 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
scala

調査の方向性

まず既存の WebSocketUpgrade API と handleWebSocketMessages API を確認し、RFC 8441 に照らして HTTP/2 の処理を追跡します。SETTINGS_ENABLE_CONNECT_PROTOCOL、Extended CONNECT、HTTP/2 status 200、フレームフロー、ストリームの終了を既存の WebSocket メッセージスタックにどのように統合するかを定義します。完了条件は、合意された API とサーバー側の動作があり、受け入れられた HTTP/2 WebSocket ストリームと終了した HTTP/2 WebSocket ストリームがカバーされていることです。

索引モデルが issue の本文から書いたものです。

説明

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, and Sec-WebSocket-Version
  • accepted WebSockets return 101 Switching Protocols
  • the existing WebSocketUpgrade API 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 = 1 when 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 / WebSocketUpgrade style APIs to work where practical
  • respond with HTTP/2 :status = 200 when 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:

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.websocket or pekko.http.server.http2?
  • Should the existing WebSocketUpgrade API 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?
主要言語
Scala
スター
196
フォーク
56
平均マージ
1日 18時間
マージ済み PR(30日)
43

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/pekko-http のほかの issue

apache/pekko-http の issue をすべて見る

似ている issue

Scala の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。