question

kishorekumar-4126 avatar image
0 Votes"
kishorekumar-4126 asked kishorekumar-4126 edited

dotnet core clientwebsocket how to read response headers

Dear Experts,

I am trying to create websocket client using ClientWebSocket class.
After connetion is successful,
1. How I can get WebSockey-Accept-key
2. How to set proxy
3. how to inspect response headers


Please help me above points.

Thanks,
Kumar



dotnet-csharp
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

How I can get WebSockey-Accept-key

You mean Sec-WebSocket-Accept header??? The ClientWebSocket class does not expose the header value. See the source code on GitHub. I'm sure you can modify the client a bit to expose the value

How to set proxy

See the proxy option in ClientWebSocket class docs.

how to inspect response headers

A network sniffer like Wireshark. Over modify the ClientWebSocket similar to question 1.






0 Votes 0 ·

Dear AgaveJoe,

Thank you very much for your help.

You mean Sec-WebSocket-Accept header??? The ClientWebSocket class does not expose the header value. See the source code on GitHub. I'm sure you can modify the client a bit to expose the value

yes. It is Sec-WebSocket-Accept header. I am not sure how i can modify the client, can you give some snippet of code.

See the proxy option in ClientWebSocket class docs.

Thank you very much.

A network sniffer like Wireshark. Over modify the ClientWebSocket similar to question 1.

I mean If the socket server returns 401 or other status code how I can access the response headers from client side?

Also, how ClientWebSocket can receive pong message ?


Thanks for your help.

Regards,
Kumar







0 Votes 0 ·

1 Answer

kishorekumar-4126 avatar image
0 Votes"
kishorekumar-4126 answered kishorekumar-4126 edited

Dear @AgaveJoe ,

Thank you very much for your help.

You mean Sec-WebSocket-Accept header??? The ClientWebSocket class does not expose the header value. See the source code on GitHub. I'm sure you can modify the client a bit to expose the value

yes. It is Sec-WebSocket-Accept header. I am not sure how i can modify the client, can you give some snippet of code.

See the proxy option in ClientWebSocket class docs.

Thank you very much.

A network sniffer like Wireshark. Over modify the ClientWebSocket similar to question 1.

I mean If the socket server returns 401 or other status code how I can access the response headers from client side?

Also, how ClientWebSocket can receive pong message ?


Thanks for your help.

Regards,
Kumar







5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.