static void Main(string[] args)
        {
            JsonRpc.RegisterMethods(typeof(Program).Assembly);
            JsonRpc.Start("http://*:80");

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            JsonRpc.OnReceivedRequest(c =>
            {
                Console.WriteLine($"Received jsonRpcRequest {c.Request.Method}");
                return(Task.CompletedTask);
            });

            JsonRpc.Start();
            Console.ReadLine();
            JsonRpc.Stop();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Masternode.StartMonitoring();

            JsonRpc.OnReceivedHttpRequest(c =>
            {
                c.Response.AddHeader("Access-Control-Allow-Origin", "*");

                if (c.Request.HttpMethod == "OPTIONS")
                {
                    c.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
                    c.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST");
                    c.Response.Close();
                }

                return(Task.CompletedTask);
            });

            JsonRpc.OnReceivedRequest(c =>
            {
                Console.WriteLine($"method: {c.Request?.Method} params: {c.Request?.Params}");

                return(Task.CompletedTask);
            });

            var address = "http://*:5000";

#if DEBUG
            address = "http://localhost:5000/";
#endif

            JsonRpc.Start(address);

            Console.CancelKeyPress += (sender, eventArgs) => ResetEvent.Set();
            ResetEvent.WaitOne();

            JsonRpc.Stop();
        }