C
C#2y ago
VeQox

✅ hi im experimenting with websocketsservers and clients.

Im currently running the server with nodejs and the client in c#. My problem is that the Websocket.ConnectAsync just crashes without an exeption so i dont really know whats wrong. The server is running on port 8080 on localhost.
1 Reply
VeQox
VeQoxOP2y ago
im connecting to "ws://localhost:8080" which worked before but for some reason now just crashes the app
private async Task<bool> Connect(Uri uri)
{
try
{
await WebSocket.ConnectAsync(uri, CancellationToken.None);
}
catch (Exception)
{
return false;
}
return true;
}
private async Task<bool> Connect(Uri uri)
{
try
{
await WebSocket.ConnectAsync(uri, CancellationToken.None);
}
catch (Exception)
{
return false;
}
return true;
}
where uri is new Uri("ws://localhost:8080") fixed it by using this WebSocket.ConnectAsync(uri, cancellationTokenSource.Token).Wait(cancellationTokenSource.Token); dont know why this fixes it 🤷‍♂️
Want results from more Discord servers?
Add your server