0 votes

I'm trying to translate the code below into Godot but im failing to understand how to achieve that.

public static class Program {
    private static WebSocket Connection = null;

    static void Main(string[] args) {
        Connection = new WebSocket("wss://127.0.0.1:" + PORT+ "/", "wamp");
        Connection.SetCredentials("riot", "PASSWORD", true);
        Connection.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;

        Connection.OnMessage += OnWebsocketMessage;

        Connection.Connect();
        Connection.Send("[5,\"OnJsonApiEvent_lol-champ-select_v1_session\"]");
        Console.ReadKey(true);
    }

    private static void OnWebsocketMessage(object sender, MessageEventArgs e) {
        var Messages = JArray.Parse(e.Data);
        Console.WriteLine(Messages);
    }
}

(It uses following implementation: https://github.com/sta/websocket-sharp)

My current code uses the WebSocketClient and the function connect_to_url and it connects to the url wss://127.0.0.1:PORT. It emits the signal connection_error afterwards.

How do I pass the credentials within the WebSocketClient in Godot?
What do I do with the used Tls12 protocol? Do i need a SSL-Certificate? How would the certificate look like?
Im finding no answer to my questions and the emission of that signal with no further information doesn't help me in any way sadly.

Any help is very much appreciated :)

in Engine by (64 points)
edited by

Please log in or register to answer this question.

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.