dotnet core clientwebsocket how to read response headers

kishore kumar 1 Reputation point
2021-07-13T15:52:17.49+00:00

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

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,205 questions
{count} votes

1 answer

Sort by: Most helpful
  1. kishore kumar 1 Reputation point
    2021-07-15T05:43:54.563+00:00

    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 comments No comments