クライアントがセッションCookieを取得する前に、/ login urlが要求されない限り、NodeJSが接続の試行に応答しないようにします。リクエスト時にソケットを閉じるために、次のリスナーを追加しました。
server.listeners("request").unshift (request, response)->
if(request and request.url == "/login")
# Set /login as the only entrance point to the server
# A session cookie will be set here
else
# Authenticate based on the session cookie
# if the session is invalid or doesn't exist abort the connection
request.connection.destroy()
このソリューションは、私が望むことを実行するのに十分ですか、それともサーバーはクライアントとのネゴシエーションを試みたり、要求の前に応答したりしますか?同じポートでsocket.ioを介してhttpsとWebSocketを使用しています。