Skip to main content
0 votes
0 answers
10 views

Parallel Send to WebSocket using ClientWebSocket

Regarding ClientWebSocket Microsoft documentation states that Exactly one send and one receive is supported on each ClientWebSocket object in parallel. Issuing multiple sends or multiple receives at ...
Learner's user avatar
  • 55
1 vote
1 answer
96 views

How to enable compression in WebSockets in .NET 6

I am using .NET 6 to establish a WebSocket connection and I am using "ClientWebSocket" to use this.I am aware that the Server supports the "permessage-deflate" from the following ...
Learner's user avatar
  • 55
0 votes
1 answer
54 views

Awaiting ClientWebSocket.RecieveAsync in .net never returns again after returning only once

I'm using the System.Net.WebSockets.ClientWebSocket class in C# on .NET 6.0. I have a thread that will poll this ClientWebSocket repeatedly by calling a function. poll_thread = new Thread(poll); ...
FireCatMagic's user avatar
0 votes
1 answer
120 views

Awaiting ClientWebSocket.ReceiveAsync only receives one packet of information, and then all other awaits never return

I'm using the System.Net.WebSockets.ClientWebSocket class in C# on .NET 6.0. I have a timer set up that repeatedly will poll the websocket for connections, shown here. The timer is elapsed every 16 ms....
FireCatMagic's user avatar
0 votes
1 answer
122 views

ClientWebSocket - MemoryStream, message framing and performance

This is more of a theoretical question around possible performance optimizations when using C# ClientWebSocket. Consider following implementation for receiving socket messages. private async Task ...
ans's user avatar
  • 33
0 votes
1 answer
196 views

Calling ConnectAsync to a ClientWebSocket exits the method with no exception

I can't get this websocket to connect. I ran this in debug mode. Once I let the socket.ConnectAsync() call run, the program thinks for a second and exits the method call without throwing an exception. ...
CollidaCube's user avatar
0 votes
1 answer
1k views

Azure Web PubSub ClientWebSocket "The server returned status code '401' when status code '101' was expected."

I am trying to use the Web PubSub Service resource in Azure, and have created a basic client using ClientWebSocket. Everything is fine, it sits there waiting for something to come through, however, ...
percentum's user avatar
  • 143
0 votes
1 answer
465 views

.Net ClientWebSocket ReceiveAsync throwing The remote party closed the WebSocket

I have a Console App that needs to send a message to a web socket and after receive messages from it. The problem I am having is, when ClientWebSocket "ReceiveAsync" method is called, I am ...
MarchalPT's user avatar
  • 1,554
1 vote
0 answers
214 views

How to debug a hung call to ClientWebSocket.ReceiveAsync

I have a C# Windows Forms Application that sends and receives data using ClientWebSocket. At some point, the call to ClientWebSocket.ReceiveAsync hangs and doesn't return. WebSocketReceiveResult ...
ddrjca's user avatar
  • 482
3 votes
0 answers
141 views

How can I use ClientWebSocket to connect to a WebApplicationFactory test host?

I am creating a test server for integration tests like so, and this works well for all HttpClient requests... Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "...
Peter Morris's user avatar
  • 22.9k
0 votes
1 answer
1k views

ReceiveAsync's CancellationToken paramtere is doing timeout even if the web socket client is still connected

How do I make ClientWebSocket.ReceiveAsync timeout in 5 seconds only if the web socket client is not connected? The current behavior is that it timeouts no matter what conditions are met, i.e. whether ...
nop's user avatar
  • 6,133
0 votes
1 answer
788 views

Best way to mock System.Net.WebSockets ClientWebSocket class to unit test (nunit)

I have used ClientWebSocket class for webSocket communication. What is the best way of mocking the class?
Atulya's user avatar
  • 162
1 vote
0 answers
433 views

ClientWebSocket Alternative That Can Access HTTP Response Headers in Server Handshake Response?

I am developing a WebSocket client application using C#/.NET. Up until this point, I have been using the class System.Net.WebSockets.ClientWebSocket to implement the client. Unfortunately, I recently ...
Felix's user avatar
  • 25
1 vote
0 answers
849 views

How do I change the "Source IP" of ClientWebSocket and HttpClient (GET, POST) in C #?

I am using a VPS server with several white IP addresses. I need to make connections to the server using HttpClient and ClientWebSocket that has a command processing limit set. How do I change the ...
Fapser Faps's user avatar
0 votes
1 answer
1k views

Receiving messages using ClientWebSocket Class throws exception: The WebSocket received a frame with one or more reserved bits set

I 'd like to make a websocket client to connect to a third-party web socket server. I am using ClientWebSocket Class: public WSClientService(ClientWebSocket client, ILogger<WSClientService> ...
ggeorge's user avatar
  • 1,620

15 30 50 per page