How to implement subprotocol in my .net Application

I want to add the subprotocol in my client web socket. I try to do it in


many other ways. but fail to do so. If anyone can help with it.
WhatsApp Image 2022-04-23 at 1.34.08 PM

Hi @Iqra_Mustafa1

Subprotocols should not be appended to the URI. You should add them with AddSubProtocol method to ClientWebSocketOptions which you can access through the Options property of your ClientWebSocket instance. Since subprotocols are negotiated during handshake, please make sure you add subprotocols before you connect.

Hope this helps,
Mate

3 Likes

Thanks for the help. It worked.