Example #1
0
        public void Subscibe(CallMessage call, SubscribeResult handler)
        {
            lock (this)
                call.Id = lastId++;

            sendToServer(call.ToString());

            var tcs = new TaskCompletionSource <ResultMessage>();

            lock (this)
                subscribes[call.Id] = handler;
        }
Example #2
0
        public Task <ResultMessage> Call(CallMessage call)
        {
            lock (this)
                call.Id = lastId++;

            sendToServer(call.ToString());

            var tcs = new TaskCompletionSource <ResultMessage>();

            lock (this)
                callers[call.Id] = tcs;

            return(tcs.Task);
        }