Class EventBus
Defined in File EventBus.h
Class Documentation
-
class EventBus
Handling of all network events.
Public Types
-
typedef std::function<void(bool, const csp::common::Array<ReplicatedValue>&)> ParameterisedCallbackHandler
Public Functions
-
void SendNetworkEvent(const csp::common::String &EventName, const csp::common::Array<ReplicatedValue> &Args, ErrorCodeCallbackHandler Callback)
Sends a network event by EventName to all currently connected clients.
- Parameters
EventName – csp::common::String : The identifying name for the event.
Args – csp::common::Array<ReplicatedValue> : An array of arguments (ReplicatedValue) to be passed as part of the event payload.
Callback – ErrorCodeCallbackHandler : a callback with failure state.
-
void SendNetworkEventToClient(const csp::common::String &EventName, const csp::common::Array<ReplicatedValue> &Args, uint64_t TargetClientId, ErrorCodeCallbackHandler Callback)
Sends a network event by EventName, to TargetClientId.
- Parameters
EventName – csp::common::String : The identifying name for the event.
Args – csp::common::Array<ReplicatedValue> : An array of arguments (ReplicatedValue) to be passed as part of the event payload.
TargetClientId – uint64_t : The client ID to send the event to.
Callback – ErrorCodeCallbackHandler : a callback with failure state.
-
void ListenNetworkEvent(const csp::common::String &EventName, csp::systems::SystemBase *System)
Registers a system to listen for the named event, where the system can define its.
own callback and deserialiser.
- Parameters
EventName – csp::common::String : The identifying name for the event to listen for.
System – csp::systems::SystemBase* : A pointer to the system which wants to register for the event.
-
void ListenNetworkEvent(const csp::common::String &EventName, ParameterisedCallbackHandler Callback)
Registers a callback to listen for the named event.
- Parameters
EventName – csp::common::String : The identifying name for the event to listen for.
Callback – ParameterisedCallbackHandler : A callback to register for the event which contains the parameter payload data.
-
void StopListenNetworkEvent(const csp::common::String &EventName)
Stops the event bus from listening for a particular event, for any system or callback.
that were registered.
- Parameters
EventName – csp::common::String : The identifying name for the event to stop listening for.
-
void StartEventMessageListening()
Instructs the event bus to start listening to messages.
-
typedef std::function<void(bool, const csp::common::Array<ReplicatedValue>&)> ParameterisedCallbackHandler