I tried looking everywhere for the solution, but I wasn't able to find out how to do it.
WebSocket websocket = new WebSocket("wss://url.com");
//How would I add custom headers around here, like User-Agent etc?
websocket.Opened += (sender1, e2) =>
{
MessageBox.Show("Connected to WebSocket server");
};
websocket.Open();
I tried looking around and hopped around 2-3 different websocket packages but it seems like they all either couldn't handle my websocket connection properly or they didn't support custom headers. Any help would be appreciated.
To add custom headers with WebSocket4Net, you can pass them in the constructor of the WebSocket instance:
If Websocket4Net does not support this directly in the version you're using, or if the constructor does not allow custom headers, you may need to check the documentation or repo for the version you're using.