Example #1
0
        public async Task CanStopServer()
        {
            using (var wampServer = new WampServer("localhost", 16000))
            {
                wampServer.Start();

                using (var wampClient = new WampClient("localhost", 16000))
                {
                    var delay = Task.Delay(5000);
                    var connect = wampClient.Connect();

                    var t = await Task.WhenAny(delay, connect);

                    Assert.That(t.Id, Is.EqualTo(connect.Id), "Couldn't connect");
                }

                wampServer.Stop();

                using (var wampClient = new WampClient("localhost", 16000))
                {
                    var delay = Task.Delay(5000);
                    var connect = wampClient.Connect();

                    var t = await Task.WhenAny(delay, connect);

                    Assert.That(t.Id, Is.EqualTo(delay.Id), "Shouldn't have been able to connect");
                }
            }

        }
Example #2
0
        static void Main()
        {
            FleckLog.Level = LogLevel.Debug;
            var server = new WampServer("ws://localhost:8181");

            server.Start(wamp =>
            {
                wamp.OnEvent = OnEvent;
                wamp.OnCall  = OnCall;
            });

            var input = Console.ReadLine();

            while (input != "exit")
            {
                input = Console.ReadLine();
            }
        }
Example #3
0
 public void SetUp()
 {
     _wampServer = new WampServer("localhost", 16000);
     _wampServer.Start();
 }