Пример #1
0
        private void Message(object sender, DdpMessage e)
        {
            if (e.Body["collection"] == null)
            {
                return;
            }
            if (e.Body["collection"].ToObject <string>() != Name)
            {
                return;
            }

            switch (e.Msg)
            {
            case "added":
                HandleAdded(e.Get <SubAddedModel <T> >());
                break;

            case "changed":
                HandleChanged(e.Get <SubChangedModel <T> >());
                break;

            case "removed":
                HandleRemoved(e.Get <SubRemovedModel>());
                break;

            case "addedBefore":
                HandleAddedBefore(e.Get <SubAddedBeforeModel <T> >());
                break;

            case "movedBefore":
                HandleMovedBefore(e.Get <SubMovedBeforeModel>());
                break;
            }
        }
Пример #2
0
        private void Message(object sender, DdpMessage e)
        {
            switch (e.Msg)
            {
            case "nosub":
                HandleNoSub(e.Get <NoSubModel>());
                break;

            case "ready":
                SubReadyModel ready = e.Get <SubReadyModel>();
                if (ready.Subs.Contains(Id))
                {
                    HandleReady();
                }
                break;
            }
        }
Пример #3
0
        private void WebSocketMessage(object sender, DdpMessage e)
        {
            switch (e.Msg)
            {
            case "connected":
            case "failed":
                HandleConnect(e.Msg == "connected", e.Get <JToken>());
                break;

            case "ping":
                HandlePing(e.Get <PingModel>());
                break;

            case "pong":
                HandlePong(e.Get <PongModel>());
                break;

            case "result":
                HandleMethod(e.Get <MethodResponse>());
                break;
            }
        }