webSocketStartup logs "theWsServer.listen is not a function" — redundant .listen() call after constructor already starts the server

オープン 初心者向け
#4 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
javascript, node.js

調査の方向性

appserver.jsを開いてwebSocketStartupを見つけ、websocket.Serverの構築と、その後に続くstartup呼び出しを確認します。冗長なlisten呼び出しを削除し、startupでnot-a-functionメッセージがログに出力されなくなったことと、WebSocket接続が引き続き機能することを確認します。

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

説明

When installing a test instance of rss.chat, Claude Code flagged an websockets error that turned out to not be an error. Here is Claude's bug report.


In appserver.js v0.8.3, the webSocketStartup function (rewritten 5/25/25) calls theWsServer.listen() after constructing the server with a port option:

theWsServer = new websocket.Server({port: config.websocketPort}); //5/25/25 by DW
theWsServer.on ("connection", handleWebSocketConnection);         //5/25/25 by DW
console.log ("webSocketStartup: config.websocketPort == " + config.websocketPort);
theWsServer.listen (config.websocketPort);   // ← throws

ws.Server has never exposed a public .listen() method. When you pass port to the constructor, the library creates an internal net.Server and calls .listen() on it automatically — the socket is already bound and ready before that last line runs. The call throws, the catch logs "webSocketStartup: err.message == theWsServer.listen is not a function", and the function returns.

The server is not broken — port binding and the connection handler are both set up before the throw, so WebSocket connections work normally. But the logged message looks like a fatal startup failure and will alarm anyone reading the logs.

Fix: remove the redundant .listen() call.

function webSocketStartup () {
    if (config.flWebsocketEnabled) {
        try {
            theWsServer = new websocket.Server({port: config.websocketPort});
            theWsServer.on ("connection", handleWebSocketConnection);
            console.log ("webSocketStartup: listening on port " + config.websocketPort);
            }
        catch (err) {
            console.log ("webSocketStartup: err.message == " + err.message);
            }

Environment: daveappserver 0.8.3, ws 8.21.1, Node v24.18.0.

主要言語
JavaScript
スター
7
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

似ている issue

JavaScript の issue をもっと見る

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

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