0 votes


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://";

    public WebsocketService() {
        Godot.WebSocketClient ws = new Godot.WebSocketClient();

        GD.Print("Connected or not?? To " + URL);


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

asked May 27 in Projects by SirHeadless (16 points)

1 Answer

0 votes

So at the end I had to create my own WebsocketClient to connect to my server.

answered May 27 by SirHeadless (16 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.