protected void OnCommandReceived(ServerEventCommand e)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug($"[SSE-CLIENT] OnCommandReceived: ({e.GetType().Name}) #{e.EventId} on #{ConnectionDisplayName} ({string.Join(", ", Channels)})");
            }

            var hold = commandTcs;

            commandTcs = new TaskCompletionSource <ServerEventCommand>();

            OnCommand?.Invoke(e);

            hold.SetResult(e);
        }
Пример #2
0
        protected void OnCommandReceived(ServerEventCommand e)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("[SSE-CLIENT] OnCommandReceived: ({0}) #{1} on #{2} ({3})", e.GetType().Name, e.EventId, ConnectionDisplayName, string.Join(", ", Channels));
            }

            var hold = commandTcs;

            commandTcs = new TaskCompletionSource <ServerEventCommand>();

            if (OnCommand != null)
            {
                OnCommand(e);
            }

            hold.SetResult(e);
        }