示例#1
0
        private Task HandlePayloadAsync(object[] parameters)
        {
            lock (_payloadLock)
            {
                var serverPayload = (JArray)parameters[0];
                var payload       = _payloadDecompressor.DecompressPayload(serverPayload);

                OnPayload?.Invoke(payload);

                return(Task.CompletedTask);
            }
        }
示例#2
0
        private async Task HandlePayloadAsync(JArray parameters)
        {
            await _payloadLock.WaitAsync();

            try
            {
                var serverPayload = parameters;
                var payload       = _payloadDecompressor.DecompressPayload(serverPayload);
                var context       = new UpdateContext(_currentPayloadTime, payload, _initializationData);
                _currentPayloadTime = context.Time;
                await(OnUpdateAsync?.Invoke(context) ?? Task.CompletedTask);
            }
            finally
            {
                _payloadLock.Release();
            }
        }