Interface INetworkEventHandler
Assembly: Eco.Shared.dll
Syntax
public interface INetworkEventHandler
Methods
ReceiveEvent(INetClient, NetworkEvent, BSONValue)
Declaration
void ReceiveEvent(INetClient client, NetworkEvent netEvent, BSONValue bson)
Parameters
SendEvent(NetworkEvent, BSONValue, INetClient, INetObject)
Sends network event to destination target with respect to order of previously queued events.
Declaration
void SendEvent(NetworkEvent netEvent, BSONValue data, INetClient target, INetObject netObj)
Parameters
SendEvent<TScopeAwareEnumerable>(NetworkEvent, BSONValue, TScopeAwareEnumerable, INetObject)
Send event to multiple clients at once. It requires IScopeAwareEnumerable<T> for targets because may process them asynchronously and save reference to enumerable for future usage.
Explicit scope control allow us to prevent errors when targets only valid in scope of calling method and avoid defensive copy to prevent such errors when targets safe to reference outside of scope (i.e. when they're immutable or unowned right after passing to method).
Declaration
virtual void SendEvent<TScopeAwareEnumerable>(NetworkEvent netEvent, BSONValue data, TScopeAwareEnumerable targets, INetObject netObj)
where TScopeAwareEnumerable : IScopeAwareEnumerable<INetClient>
Parameters
Type Parameters
| Name |
Description |
| TScopeAwareEnumerable |
|
SendEventNow(NetworkEvent, BSONValue, INetClient)
Sends network event immediately if possible ignoring previously queued events. If not possible then fallback to SendEvent behavior. It also makes all encoding and serialization in current thread.
Declaration
void SendEventNow(NetworkEvent netEvent, BSONValue data, INetClient target)
Parameters
Extension Methods