Translate C# WebSocket script to WebSocketClient

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Grandro

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://" + PORT+ "/", "wamp");
        Connection.SetCredentials("riot", "PASSWORD", true);
        Connection.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;

        Connection.OnMessage += OnWebsocketMessage;


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

(It uses following implementation: GitHub - sta/websocket-sharp: A C# implementation of the WebSocket protocol client and server)

My current code uses the WebSocketClient and the function connect_to_url and it connects to the url wss:// 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 :slight_smile: