Ejemplo n.º 1
0
        private static void Arguments(IWampRealmServiceProvider serviceProvider)
        {
            IArgumentsService proxy = serviceProvider.GetCalleeProxy <IArgumentsService>();

            proxy.Ping();
            Console.WriteLine("Pinged!");

            int result = proxy.Add2(2, 3);

            Console.WriteLine("Add2: {0}", result);

            var starred = proxy.Stars();

            Console.WriteLine("Starred 1: {0}", starred);

            starred = proxy.Stars(nick: "Homer");
            Console.WriteLine("Starred 2: {0}", starred);

            starred = proxy.Stars(stars: 5);
            Console.WriteLine("Starred 3: {0}", starred);

            starred = proxy.Stars(nick: "Homer", stars: 5);
            Console.WriteLine("Starred 4: {0}", starred);

            string[] orders = proxy.Orders("coffee");
            Console.WriteLine("Orders 1: {0}", string.Join(", ", orders));

            orders = proxy.Orders("coffee", limit: 10);
            Console.WriteLine("Orders 2: {0}", string.Join(", ", orders));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            const string location = "ws://127.0.0.1:8080/";

            DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();

            IWampChannel channel = channelFactory.CreateJsonChannel(location, "realm1");

            IWampRealmProxy realmProxy = channel.RealmProxy;

            //await
            //channel.Open ();

            // Host WAMP application components

            Task openTask = channel.Open();

            // await openTask;
            openTask.Wait(5000);


            Console.WriteLine("Press enter when a client finishes registering methods");
            Console.ReadLine();
            IArgumentsService proxy = channel.RealmProxy.Services.GetCalleeProxy <IArgumentsService> ();

            proxy.Ping();
            Console.WriteLine("Pinged!");

            int result = proxy.Add2(2, 3);

            Console.WriteLine("Add2: {0}", result);

            var starred = proxy.Stars();

            Console.WriteLine("Starred 1: {0}", starred);

            starred = proxy.Stars(nick: "Homer");
            Console.WriteLine("Starred 2: {0}", starred);

            starred = proxy.Stars(stars: 5);
            Console.WriteLine("Starred 3: {0}", starred);

            starred = proxy.Stars(nick: "Homer", stars: 5);
            Console.WriteLine("Starred 4: {0}", starred);

            // string[] orders = proxy.Orders ("coffee");
            // Console.WriteLine ("Orders 1: {0}", string.Join (", ", orders));

            // orders = proxy.Orders ("coffee", limit : 10);
            // Console.WriteLine ("Orders 2: {0}", string.Join (", ", orders));

            Console.ReadLine();
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            DefaultWampChannelFactory factory =
                new DefaultWampChannelFactory();

            const string serverAddress = "ws://localhost:8081";

            IWampChannel channel =
                factory.CreateJsonChannel(serverAddress, "realm1");

            channel.Open().Wait(5000);

            IArgumentsService proxy =
                channel.RealmProxy.Services.GetCalleeProxy <IArgumentsService>();

            proxy.Ping();
            Console.WriteLine("Pinged!");

            int result = proxy.Add2(2, 3);

            Console.WriteLine("Add2: {0}", result);

            var starred = proxy.Stars();

            Console.WriteLine("Starred 1: {0}", starred);

            starred = proxy.Stars(nick: "Homer");
            Console.WriteLine("Starred 2: {0}", starred);

            starred = proxy.Stars(stars: 5);
            Console.WriteLine("Starred 3: {0}", starred);

            starred = proxy.Stars(nick: "Homer", stars: 5);
            Console.WriteLine("Starred 4: {0}", starred);

            string[] orders = proxy.Orders("coffee");
            Console.WriteLine("Orders 1: {0}", string.Join(", ", orders));

            orders = proxy.Orders("coffee", limit: 10);
            Console.WriteLine("Orders 2: {0}", string.Join(", ", orders));

            Console.ReadLine();
        }