Exemplo n.º 1
0
        public v1_0ServerContext(RemoterServer parent, ObservablePacketProtocol protocol)
        {
            _parent = parent;
            _client = protocol.Client;
            _protocol = protocol;
            _events = new ListKvp<string, EventPropegator>();
            _sessions = new List<string>();
            _cancelSource = new CancellationTokenSource();

            _observable = protocol.Buffer
                // .ObserveOn(ThreadPoolScheduler.Instance)
                .Subscribe(Buffer_OnNext, Buffer_OnError, Buffer_OnComplete);
        }
Exemplo n.º 2
0
        //private Subject<MPack> _buffer;

        public ObservablePacketProtocol(MessageTransferClient<byte[]> client)
        {
            this.Client = client;
            Buffer = client.MessageRecieved
                .Select(args => MPack.ParseFromBytes(args.Message))
                .Do(LogRead)
                .ToTrackableObservable();

            //_buffer = new Subject<MPack>();
            //Buffer = _buffer.ToTrackableObservable();
            //client.PacketRecieved += Recieve;
            //client.Disconnected += Disconnected;
            //client.Error += Error;
        }