Esempio n. 1
0
        public void OnUserDefinedPush(string route, byte[] serializedBody)
        {
            object decoded;

            if (_typePushSubscriber.HasType(route))
            {
                var type = _typePushSubscriber.GetType(route);
                decoded = ProtobufSerializer.Decode(serializedBody, type, PitayaBinding.ClientSerializer(_client));
            }
            else
            {
                decoded = JsonSerializer.Decode(serializedBody);
            }

            _eventManager.InvokeOnEvent(route, decoded);
        }
Esempio n. 2
0
        //---------------Pitaya Listener------------------------//

        public void OnRequestResponse(uint rid, byte[] data)
        {
            object decoded;

            if (_typeRequestSubscriber.HasType(rid))
            {
                var type = _typeRequestSubscriber.GetType(rid);
                decoded = ProtobufSerializer.Decode(data, type, PitayaBinding.ClientSerializer(_client));
            }
            else
            {
                decoded = JsonSerializer.Decode(data);
            }

            _eventManager.InvokeCallBack(rid, decoded);
        }