Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 577 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can WebSocket addresses carry parameters?

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

The address `http://myserver.com/path?param=1` (notice it's now `http` and not `ws`) works fine with [`wscat`](

[To see links please register here]

), but I can't get it working on the browser.
Reply

#2
`ws://myserver.com/path?param=1` is a valid WebSocket URI. However, the way that your WebSocket server application can access the path and query string will differ depending on what WebSocket server framework you are using.

If you are using the Node.js [`einaros/ws`](

[To see links please register here]

) library, then in your websocket connection object will have the full path with the query string at `upgradeReq.url`.

For example this:

wss.on('connection', function(ws) {
console.log("url: ", ws.upgradeReq.url);
};

will print `url: /path?param=1` when you connect to `ws://myserver.com/path?param=1`.
Reply

#3
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}`);
});

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through