Skip to main content

ConsoleEvent

An abstract class in Root.Township, Alta.Console.

Base for a named event that websocket console users can subscribe to. Messages are queued and sent from a background task, not the main thread.

Constructors​

MemberWhat it is
ConsoleEvent(string name)Creates a ConsoleEvent from name.

Fields​

2 private and internal fields
MemberWhat it is
private static ConsoleEvent.Processor processorThe shared background Processor that empties the queue.
private static BlockingCollection<ConsoleEvent.QueueItem> queueShared queue of event messages waiting to be sent to listeners.

Properties​

MemberWhat it is
bool HasListeners { get; }True when anything is subscribed to Invoked.
string Name { get; }The event's name, as console subscribers see it.

Events​

MemberWhat it is
event Action<WebSocketCommandHandler.ResponseData> InvokedRaised with the response to send, on the background processor thread.

Methods​

MemberWhat it is
virtual void Deregister()Removes every listener from Invoked. The generic version also removes the event from ConsoleEventProcessor.
protected void Invoke(WebSocketCommandHandler.ResponseData response)Queues the event to be sent to subscribed console connections.

Used in​

Members of other types that take, return or hold a ConsoleEvent: