0

So I've seen some people having issues with sending/receiving messages from Socket.io with WebSocket-Sharp, but I'm not seeing any issues with just connecting.

This is on a Windows 10 machine. From a browser, I have no issues connecting to the Socket.io using some demo code.

I'm hoping someone has come across this, and has a solution :)

Edit: Less interested in this now that I've gotten this working with another library. Hope the question helps someone else in the future though.

  • ws.Connect()
    • 12/30/2022 10:09:14 AM|Fatal|<>c__DisplayClass17.<startReceiving>b__16|WebSocketSharp.WebSocketException: A non data frame is compressed.
  • ws.ConnectAsync()
    • 12/30/2022 10:11:56 AM|Fatal|Ext.ReadBytesAsync|System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine

C# implementation of WebSocket-Sharp

using (var ws = new WebSocket("ws://localhost:1337/socket.io/?EIO=2&transport=websocket"))
{
   ws.Connect();
}

NodeJS (excluded requires), this works from a browser. (Express, NodeJS, Socket.io)

app.get('/', (req, res) => {
  res.sendFile(__dirname + '/index.html');
});

io.on('connection', (socket) => {
    console.log('Something Connected.');
  socket.on('chat message', (msg) => {
    io.emit('chat message', msg);
    console.log(msg);
  });
  socket.on('disconnect', () => {
    console.log('Something Disconnected.');
  });
});

server.listen(1337, () => {
  console.log('listening on *:1337');
});

0 Answers0