Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            ValueResource <int>     testResource = new ValueResource <int>(3, "http://127.0.0.1:3333/int/");
            ValueResource <XmlBool> test2        = new ValueResource <XmlBool>(new XmlBool(true), "http://127.0.0.1:3333/bool/");

            WebsocketSubscription      wsSubscription = new WebsocketSubscription("ws://stuff");
            WebHookSubscription        whSubscription = new WebHookSubscription("http://test");
            ObservableCollection <int> c = new ObservableCollection <int>();
            CollectionResource <ObservableCollection <int>, int> r = new CollectionResource <ObservableCollection <int>, int>(c, "http://localhost:12345/c/");

            testResource.Subscribe(whSubscription);
            testResource.Subscribe(wsSubscription);

            Console.WriteLine("Any key to change int to 12 ...");
            Console.ReadKey();
            testResource.Value = 12;

            r.Subscribe(whSubscription);
            r.Subscribe(wsSubscription);

            Console.WriteLine("Any key to add 12 to Collection...");
            Console.ReadKey();
            r.Value.Add(12);

            Console.WriteLine("Any key to close application...");
            Console.ReadKey();
        }
        private Task <WebHookSubscription> CreateWebHookSubscriptionAsync(string filter, string headers = null, string payload = null)
        {
            var container = RepositoryTools.CreateStructure("/Root/System/WebHooks", "SystemFolder") ??
                            Content.Load("/Root/System/WebHooks");

            var wh = new WebHookSubscription(container.ContentHandler)
            {
                Url    = "https://localhost:44393/webhooks/test",
                Filter = filter,
                //Filter = "{ \"Path\": \"/Root/Content\", \"ContentTypes\": [ { \"Name\": \"Folder\", \"Events\": [ \"Create\", \"Publish\" ] } ] }",
                Headers = headers,
                //Headers = "{ \"h1-custom\": \"value1\", \"h2-custom\": \"value2\" }",
                Payload = payload,
                AllowIncrementalNaming = true
            };

            wh.Save();

            return(Node.LoadAsync <WebHookSubscription>(wh.Id, CancellationToken.None));
        }