ReactClient
Inherits: ThirdPartyClient < Node < Object
A client for bidirectional communication between the engine and a React frontend.
Description
Provides a simple messaging interface for integrating a React-based frontend with the engine.
It allows the engine to send structured events to a React application via emit_to_react(), and to receive events from React through the on_react_event signal.
This is commonly used in web export environments where a React UI is responsible for presentation while the engine handles game or application logic.
Security is enforced through the allowed_origin property, which restricts which web origins are permitted to send or receive messages.
The app_key property can be used to namespace or identify the application instance when multiple clients are communicating on the same page or platform.
Properties
|
||
|
Methods
void |
emit_to_react(event_name: String, payload: Dictionary = {}) |
Signals
on_react_event(event_name: String, payload: Dictionary) 🔗
Emitted when an event is received from the React frontend.
event_name indicates the type of event sent by React, and payload contains the associated data.
Property Descriptions
Defines which web origin(s) are allowed to communicate with this client.
A value of "*" allows all origins, but for production use it is recommended to restrict this to a specific domain for security reasons.
An optional application identifier used to namespace messages between multiple clients or instances.
This can help distinguish between different React integrations running on the same page or platform.
Method Descriptions
void emit_to_react(event_name: String, payload: Dictionary = {}) 🔗
Sends an event to the connected React frontend.
event_name identifies the type of event being emitted, and payload contains optional structured data associated with the event.