partysocket: a room name with ? or # is not encoded in the URL
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
- 領域
- networking
調査の方向性
URLは packages/partysocket/src/index.ts の107行目付近にある getPartyInfo() で組み立てられており、パーティ名とルーム名がエンコードされずに挿入されています。まずそこから始め、次にissueの再現スクリプトを、それが起動するサーバーに対して実行し、? と # の動作を確認してください。ルーム a?b がクエリ文字列を保ったまま /parties/main/a%3Fb としてサーバーに届き、ルーム a#b に接続できれば完了です。partysocketのテストスイートに回帰テストも追加してください。
索引モデルが issue の本文から書いたものです。
説明
getPartyInfo() puts the party and room names into the URL as they are. A ? in a name starts the query string, so the server gets another room name and the rest of the name as a query. A # starts a fragment, and the WebSocket constructor rejects a URL with a fragment, so the socket never connects.
Repro
The packages: [email protected], [email protected]. Install them with npm i [email protected] [email protected].
// npm install, then: node repro.ts (Node.js 22.18 or later runs TypeScript directly)
import type { AddressInfo } from "node:net";
import PartySocket from "partysocket";
import { WebSocketServer } from "ws";
const wss = new WebSocketServer({ host: "127.0.0.1", port: 0 });
await new Promise((resolve) => wss.once("listening", resolve));
wss.on("connection", (_client, req) => {
console.log("the server got the URL:", req.url);
});
const host = `127.0.0.1:${(wss.address() as AddressInfo).port}`;
// room "a?b"
const a = new PartySocket({ host, room: "a?b", id: "client-1" });
await new Promise((resolve) => setTimeout(resolve, 300));
a.close();
// room "a#b"
const b = new PartySocket({ host, room: "a#b", minReconnectionDelay: 50, maxReconnectionDelay: 50 });
let errors = 0;
let firstError: string | undefined;
b.addEventListener("error", (e) => {
errors++;
firstError ??= e.message;
});
await new Promise((resolve) => setTimeout(resolve, 500));
console.log(`room "a#b": ${errors} error events in 500 ms, the first: ${firstError}`);
b.close();
for (const client of wss.clients) client.terminate();
wss.close();
node repro.ts (Node.js 22.18 or later runs TypeScript directly)
Actual
the server got the URL: /parties/main/a?b?_pk=client-1
room "a#b": 10 error events in 500 ms, the first: hash
Expected
The room name stays in the path of the URL, for example /parties/main/a%3Fb?_pk=client-1, and a room name with # connects.
A fix
A fix with a new test is on the branch fix/partysocket-encode-room-name of my fork, at 720a46c. On a GitHub Actions runner, the new test fails before the change and passes after it, and the whole partysocket suite passes. This repository accepts pull requests only from collaborators, so I did not open a pull request. I can open one if you allow it, or you can take the commit.
I found this with AI assistance (Claude) during a review of WebSocket client libraries. The repro above was run with partysocket 1.3.0 on Node.js 24.22.2 on Linux (a GitHub Actions runner), and the output above is from that run. The fix was also prepared with AI assistance (Claude).
- 主要言語
- TypeScript
- スター
- 1.3k
- フォーク
- 86
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudflare/partykit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
cloudflare/partykit#444 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
cloudflare/partykit#434 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloudflare/partykit#430 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
cloudflare/partykit#429 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloudflare/partykit#428 ·
cloudflare/partykit の issue をすべて見る
似ている issue
-
bug parity
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
WenyuChiou/agent-board#1489 ·
メンテナーはふだん 1 日以内に返信
-
area: bazaar bug complexity: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
accensa/x402-facilitator-stellar#779 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue P4 size:S web-ui
難易度 2/5 半日 初心者へのやさしさ 85/100
josephfung/curia#2600 ·
メンテナーはふだん 1 日以内に返信