Can WebSocket addresses carry parameters?

后端 未结 2 773
忘掉有多难
忘掉有多难 2020-12-24 07:27

Is ws://myserver.com/path?param=1 a valid WebSocket address ?

The address http://myserver.com/path?param=1 (notice it\'s now http

2条回答
  •  抹茶落季
    2020-12-24 07:48

    To use with latest ws, the connection callback now has another argument - which is req.

    wss.on("connection", (ws, req) => {
       console.log(`Conn Url ${req.url}`);
    });
    

提交回复
热议问题