Class EventReceiver<T>
Creates an event receiver that is used to receive T type events from an EventKey
public sealed class EventReceiver<T> : EventReceiverBase<T>, IDisposable
Type Parameters
T
The type of data the EventKey will send
- Inheritance
-
EventReceiver<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
EventReceiver(EventKey<T>, EventReceiverOptions)
Creates an event receiver, ready to receive broadcasts from the key
public EventReceiver(EventKey<T> key, EventReceiverOptions options = EventReceiverOptions.None)
Parameters
key
EventKey<T>The event key to listen from
options
EventReceiverOptionsOption flags
Methods
ReceiveAsync()
Awaits a single event
public Task<T> ReceiveAsync()
Returns
- Task<T>
TryReceive(out T)
Receives one event from the buffer, useful specially in Sync scripts
public bool TryReceive(out T data)
Parameters
data
T
Returns
TryReceiveAll(ICollection<T>)
Receives all the events from the queue (if buffered was true during creations), useful mostly only in Sync scripts
public int TryReceiveAll(ICollection<T> collection)
Parameters
collection
ICollection<T>