You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello:
I need some code sample on how to detect WebSocket (wss) requests.
Basically, I can visit this URL with Chrome: https://www.websocket.org/echo.html
And click on “Connect” button to connect with the WebSocket server: wss://echo.websocket.org
Then type something in the message box, or using the default text in the message box “Rock it with HTML5 WebSocket”, then click on “Send” button, then I can see the messages on the “log” textbox, like this:
CONNECTED
SENT: Rock it with HTML5 WebSocket
RECEIVED: Rock it with HTML5 WebSocket
Then open Developer Tools from Chrome, on “Network” tab, I can see there is only one WS (WebSocket) request with the following headers:
Request URL:
wss://echo.websocket.org/?encoding=text
Request Method:
GET
Status Code:
101 Web Socket Protocol Handshake
I can use Chrome developer tools to convert the WebSocket request to Node.JS fetch:
fetch("wss://echo.websocket.org/?encoding=text", {
"headers": {
"accept-language": "en-US,en;q=0.9,fr;q=0.8,nl;q=0.7,zh-CN;q=0.6,zh;q=0.5,zh-TW;q=0.4",
"cache-control": "no-cache",
"pragma": "no-cache",
"sec-websocket-extensions": "permessage-deflate; client_max_window_bits",
"sec-websocket-key": "PVg+yYO5Q3EVgtPLLV2QXQ==",
"sec-websocket-version": "13"
},
"body": null,
"method": "GET",
"mode": "cors"
});
Let me know how I can use this repo to get all the headers, actually, there is only one header I need to get is: "sec-websocket-key": "PVg+yYO5Q3EVgtPLLV2QXQ=="
In my real-world job, I have to detect webscoket request from one specific web site. Using Chrome devtools, I can see that the web page uses rather complicated JavaScript to generate a websocket request, and sends it to the server. I want to write some kind of browser extension to detect the websocket request headers, actually, I only need this header: "sec-websocket-key".
Please advise,
Thanks,
The text was updated successfully, but these errors were encountered:
Hello:
I need some code sample on how to detect WebSocket (wss) requests.
Basically, I can visit this URL with Chrome: https://www.websocket.org/echo.html
And click on “Connect” button to connect with the WebSocket server: wss://echo.websocket.org
Then type something in the message box, or using the default text in the message box “Rock it with HTML5 WebSocket”, then click on “Send” button, then I can see the messages on the “log” textbox, like this:
CONNECTED
SENT: Rock it with HTML5 WebSocket
RECEIVED: Rock it with HTML5 WebSocket
Then open Developer Tools from Chrome, on “Network” tab, I can see there is only one WS (WebSocket) request with the following headers:
Request URL:
wss://echo.websocket.org/?encoding=text
GET
101 Web Socket Protocol Handshake
I can use Chrome developer tools to convert the WebSocket request to Node.JS fetch:
fetch("wss://echo.websocket.org/?encoding=text", {
"headers": {
"accept-language": "en-US,en;q=0.9,fr;q=0.8,nl;q=0.7,zh-CN;q=0.6,zh;q=0.5,zh-TW;q=0.4",
"cache-control": "no-cache",
"pragma": "no-cache",
"sec-websocket-extensions": "permessage-deflate; client_max_window_bits",
"sec-websocket-key": "PVg+yYO5Q3EVgtPLLV2QXQ==",
"sec-websocket-version": "13"
},
"body": null,
"method": "GET",
"mode": "cors"
});
Let me know how I can use this repo to get all the headers, actually, there is only one header I need to get is: "sec-websocket-key": "PVg+yYO5Q3EVgtPLLV2QXQ=="
In my real-world job, I have to detect webscoket request from one specific web site. Using Chrome devtools, I can see that the web page uses rather complicated JavaScript to generate a websocket request, and sends it to the server. I want to write some kind of browser extension to detect the websocket request headers, actually, I only need this header: "sec-websocket-key".
Please advise,
Thanks,
The text was updated successfully, but these errors were encountered: