doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
721 stars 124 forks source link

App terminates with no exceptions after running await client.ConnectAsync(); #291

Closed wout-junius closed 2 years ago

wout-junius commented 2 years ago

So the program exits whitout connecting to my server. It exits with no exceptions or problems.

(process 25504) exited with code 0.

Socket.io client version : 3.0.6

Code:

class Program
    {
        public static void Main()
        {
            MainAsync().GetAwaiter().GetResult();
        }

        private static async Task MainAsync()
        {
            var client = new SocketIO("http://localhost:8080");

            client.On("message", response =>
            {
                Console.WriteLine(response);
            });

/*            client.OnConnected += async (sender, e) =>
            {
                 // Emit a string
                 await client.EmitAsync("register", ".Net App");
            };*/
            await client.ConnectAsync();
        }
    }
wout-junius commented 2 years ago

Issue resolved by adding Console.Readline() to leave the app open.