openresty / openresty/lua-resty-websocket

RFC 8441 support: WebSockets over h2, h2c

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
523
Forks
112
Avg merge
1d 16m
Merged PRs (30d)
2

Description

Feature Request: Introduce support for WebSockets over HTTP/2 (h2 and h2c) for the server and client.

The use-case is mainly reducing the TCP connection count by leveraging HTTP/2 multiplexing. For example, a WebSocket reverse proxy could multiplex many incoming WebSockets to a single outgoing HTTP/2 connection.

Specification: RFC 8441: Bootstrapping WebSockets with HTTP/2

For the WebSocket server this requires support in ngx.req.connect.

For the WebSocket client, it's much more complicated. I think without core modifications, the only way to multiplex is by having an NGINX light thread that runs a pure-Lua HTTP/2 implementation over cosockets, and then doing cross-coroutine IPC with this thread to create WebSockets and send/receive messages. lua-resty-http2 looks like a great candidate.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RFC 8441 and the mentioned ngx.req.connect entry point for server-side requirements. For the client side, review the proposed lua-resty-http2 approach and its coroutine IPC implications. Done means WebSocket server and client support works over both h2 and h2c with HTTP/2 multiplexing.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.