Пример #1
0
 public override void Init()
 {
     DiskSerializer      = new DiskSerializer(this);
     SubscriptionManager = new SubscriptionManager(Link);
     StreamManager       = new StreamManager(Link);
     SuperRoot           = new Node("", null, Link);
 }
Пример #2
0
 private void CloseMethod(JObject request)
 {
     if (request["rid"] != null)
     {
         StreamManager.CloseStream(request["rid"].Value <int>());
     }
 }
Пример #3
0
 /// <summary>
 /// Responder constructor
 /// </summary>
 /// <param name="link"></param>
 internal Responder(AbstractContainer link)
 {
     _link               = link;
     SuperRoot           = new Node("", null, _link);
     SubscriptionManager = new SubscriptionManager(_link);
     StreamManager       = new StreamManager(_link);
     NodeClasses         = new Dictionary <string, Action <Node> >();
 }
Пример #4
0
        private void ListMethod(JArray responses, JObject request)
        {
            var requestId = request["rid"].Value <int>();
            var value     = request["path"].Value <string>();

            var node = SuperRoot.Get(value);

            if (node != null)
            {
                StreamManager.OpenStream(requestId, node);
                responses.Add(new JObject
                {
                    new JProperty("rid", requestId),
                    new JProperty("stream", "open"),
                    new JProperty(
                        "updates",
                        SubscriptionManager.SerializeUpdates(
                            SuperRoot.Get(value)
                            )
                        )
                });
            }
            else
            {
                responses.Add(new JObject
                {
                    new JProperty("rid", requestId),
                    new JProperty("stream", "open"),
                    new JProperty(
                        "updates",
                        SubscriptionManager.SerializeUpdates(
                            new Node("", null, null)
                            )
                        )
                });
            }
        }