Hey,
I'm trying to connect to a Server on my local machine via Websocket. I'm using C# and my attempt to connect looks like this
using Godot;
using System;
public class WebsocketService {
// private string URL = "ws://echo.websocket.org";
private string URL = "ws://127.0.0.1:8080/ws-chat/123?name=Hostname";
public WebsocketService() {
Godot.WebSocketClient ws = new Godot.WebSocketClient();
ws.ConnectToUrl(URL);
GD.Print("Connected or not?? To " + URL);
GD.Print(ws.GetConnectedHost());
}
}
I get the following error
E 0:00:00.537 get_connected_host: Condition "!_peer->is_connected_to_host()" is true. Returned: IP_Address()
<C++ Source> modules/websocket/wsl_client.cpp:318 @ get_connected_host()
<Stack Trace> :0 @ System.String Godot.NativeCalls.godot_icall_0_2(IntPtr , IntPtr )()
WebSocketClient.cs:108 @ System.String Godot.WebSocketClient.GetConnectedHost()()
WebsocketService.cs:18 @ WebsocketService..ctor()()
Board.cs:17 @ Board..ctor()()
When using GDScript I have no problems to connect to my server via websocket.
Has anybody experience with this issue.
Thank you for your help