sta / sta/websocket-sharp

Can I use this repo to detect websocket http request header: sec-websocket-key?

Open
#670 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

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,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by reviewing websocket-sharp's handling of WebSocket handshake headers and determine whether the requested browser-extension header capture is within this repository's scope. Done would require a decided scope and documented feasibility or an explicitly defined implementation target.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.