I am working on a small project in C# where I need to create a socket client and watch the socket for a json file.
I have tried a few thing and every time I run the project I get the error:
PM|Fatal|StackBuilderSink._PrivateProcessMessage|WebSocketSharp.WebSocketExceptio n: An exception has occurred while reading an HTTP request/response. ---> System.IO.EndOfStreamException: The header cannot be read from the data source.
Some background. For testing I am using node.js with socket.io to read a Json file and io.emit the data. I know the data is formatted correctly I have a HTML/java script page that sees the data and does stuff with it.
public MainWindow()
{
InitializeComponent();
using (var ws = new WebSocket("ws://127.0.0.1:8889"))
{
ws.OnMessage += (sender, e) =>
json_output.Text = (e.Data);
ws.ConnectAsync();
}
}