Questions tagged [clientwebsocket]

WebSocket clients are the applications that use the WebSocket API to communicate with WebSocket servers using the WebSocket protocol.

WebSocket clients are the applications that use the WebSocket API to communicate with WebSocket servers using the WebSocket protocol.

30 questions
10
votes
1 answer

Choosing a buffer size for a WebSocket response

I'm writing a C# application that connects to a websocket server, and receives a JSON response of unknown size. I'm using the ClientWebSocket class for this purpose. The only way to receive data from the client seems to be with the ReceiveAsync…
Migwell
  • 14,206
  • 17
  • 65
  • 122
7
votes
1 answer

Asp.Net open websocket as a client

In my application I use SignalR for messaging through my clients. The application however has a websocket connection to another server for notifications like this: var wsURL = (isSecure() ? "wss://" : "ws://") + wsEndpointURI + "?token=" + token +…
6
votes
2 answers

Setting "User-Agent" HTTP header in ClientWebSocket

I need to set the "User-Agent" HTTP header in a ClientWebSocket object, but it is not possible. Although there is a ClientWebSocket.SetRequestHeader(header,value), the method fails if I try to set that header: System.ArgumentException: This header…
vtortola
  • 32,045
  • 25
  • 144
  • 246
4
votes
2 answers

c# Detect when ClientWebSocket is disconnected (closed)

After a long search i come to you to help me. I have a WPF application, use ClientWebSocket class (using System.Net.WebSockets) to connect to WebSocket server(NodeJS). My application is running backgroung windows application, it connects at first…
4
votes
1 answer

How do you create a client using websocket-sharp?

I'm using ClientWebSocket to subscribe to a REST service but want to be able to use websocket-sharp instead. static async void MonitorISY(string IPAddress, string userName, string password, IMessageWriter writer) { …
WhiskerBiscuit
  • 4,387
  • 6
  • 44
  • 86
4
votes
0 answers

Xamarin ClientWebSocket... Can't re-connect after connection lost

I am developing Android app using ClientWebSocket. When I start the app, everything works correctly if the server is running. After I stop the server, the client can't be re-connected to the server and can't receive messages. I noticed that the…
Mouhannad Bar
  • 101
  • 1
  • 6
4
votes
0 answers

Unable to connect to the remote server using ClientWebSocket

I'm trying to connect to a web socket server on localhost:9222 using this C# code: var ws = new ClientWebSocket(); var uri = new Uri("ws://localhost:9222/X/Y/Z", UriKind.Absolute); await ws.ConnectAsync(uri, CancellationToken.None); On that last…
Markus Johnsson
  • 3,741
  • 18
  • 30
3
votes
3 answers

Testing TestHost.WebSocketClient with ClientWebSocket .net core

I have build a WebSocket web application in .net core by following this and this or this tutorials. Now I am trying to write some integration tests on this by using Microsoft.AspNetCore.TestHost The way I create the WebSocket public static…
3
votes
1 answer

Thread-safety of System.Net.WebSockets.ClientWebSocket

The document is unclear about the thread safety of the System.Net.WebSockets.ClientWebSocket class. Is it safe to call the SendAsync method from multiple threads simultaneously?
Mr.Wang from Next Door
  • 10,685
  • 10
  • 47
  • 76
2
votes
0 answers

C# ClientWebSocket not receiving all packets?

I've built a windows service that subscribes to around 10,000 stock tickers in real-time using ClientWebSocket. If I subscribe to 1,000 tickers I receive all the data points as I should (receiving few hundred messages a second), as soon as I get up…
Nick D
  • 39
  • 4
2
votes
1 answer

What is the most proper way to close a websocket

In my .NET Core console app I use collection of ClientWebSocket objects to receive some data. When something goes wrong and an exception occurs I'd like to close all websockets. I tried to do this in such way: foreach (var socket in _sockets) { …
OL.
  • 161
  • 12
2
votes
0 answers

Can an Outlook js add-in receive push notifications from an external server using web sockets or similar?

I'm trying to create a near real-time two way sync experience with my cloud based CRM and a user's Outlook Calendar. If the client makes a change in the cloud CRM, my cloud based server should push a notification to the Outlook Add-In to update the…
Tion
  • 1,460
  • 17
  • 27
1
vote
1 answer

ClientWebSocket.ConnectAsync crashes with out any error info

I am trying to connect to a WebSocket API from a C# console app. My code crashes on ConnectAsync method and it wont fall in catch block or give any error. Here is my code public async System.Threading.Tasks.Task
Get(string locationUid,…
HaBo
  • 12,509
  • 34
  • 102
  • 191
1
vote
1 answer

Get Data from WebSocket using .Net ClientWebSocket

I need to collect data from a WebSocket. If I try to test the websocket with this site: http://www.websocket.org/echo.html I can connect and send message without problem but when I try to connect to the websocket using .Net Framework libraries I…
DarioN1
  • 2,179
  • 6
  • 28
  • 57
1
vote
0 answers

WebSocket Vs ClientWebsocket in C#

I have a C# class to manage a connection between a server and a win forms app. This class sets up a message queue and sends and receives data across the Socket. My original intention was to use the same class on both the client and the server to…
Lightning77
  • 173
  • 1
  • 14
1
2