Ejemplo n.º 1
0
        static async Task RunChatClient(ClientActorSystem system)
        {
            const string room = "Orleankka";

            Console.WriteLine("Connecting to server ...");
            await system.Connect(retries: 2);

            Console.WriteLine("Enter your user name...");
            var userName = Console.ReadLine();
            
            var client = new ChatClient(system, userName, room);
            OnClusterConnectionLost += ()=> client.Resubscribe().Wait();

            await client.Join();

            while (true)
            {
                var message = Console.ReadLine();

                if (message == "quit")
                {
                    await client.Leave();
                    break;
                }

                if (message == "reconnect")
                {
                    await client.Resubscribe();
                    continue;
                }

                await client.Say(message);
            }
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Please wait until Chat Server has completed boot and then press enter.");
            Console.ReadLine();

            Console.WriteLine("Connecting to server ...");
            var system = await Connect(retries : 2);

            Console.WriteLine("Enter your user name...");
            var userName = Console.ReadLine();

            const string room = "Orleankka";

            var client = new ChatClient(system, userName, room);

            OnClusterConnectionLost += async() => await client.Resubscribe();

            await client.Join();

            while (true)
            {
                var message = Console.ReadLine();

                if (message == "quit")
                {
                    await client.Leave();

                    break;
                }

                if (message == "reconnect")
                {
                    await client.Resubscribe();

                    continue;
                }

                await client.Say(message);
            }
        }