UReactBridgeSenderComponent
Source: SampleProject/Plugins/UnrealReactBridge/Source/UnrealReactBridge/Public/ReactBridgeSenderComponent.h
UActorComponent that pushes typed events from gameplay to React. Drop it on any Actor; choose a target HUD with TargetBridgeName or leave empty to broadcast to every active layer.
- UCLASS:
ClassGroup = ("Web HUD"),BlueprintSpawnableComponent - Display name: React Bridge Sender
- Add via: Components panel → Add → search "React Bridge Sender"
Properties
| Property | Type | Category | Notes |
|---|---|---|---|
TargetBridgeName | FString (EditAnywhere, BlueprintReadWrite) | React Bridge | Routes Push calls to the named layer. Empty = broadcast to every registered HUD widget. Case-sensitive; must match an Add Web HUD Name or UWebHUDWidget::BridgeName. |
Push helpers
All Push helpers live under category React Bridge|Push. They wrap the value (except PushMap / PushRaw) in { "value": ... } and dispatch through UUnrealReactBridgeSubsystem. The React side reads event.detail.
| Helper | Signature | event.detail shape |
|---|---|---|
PushFloat | void PushFloat(const FString& EventName, float Value) | { "value": 75 } |
PushInt | void PushInt(const FString& EventName, int32 Value) | { "value": 42 } |
PushString | void PushString(const FString& EventName, const FString& Value) | { "value": "alice" } |
PushBool | void PushBool(const FString& EventName, bool Value) | { "value": true } |
PushVector | void PushVector(const FString& EventName, FVector Value) | { "value": { "X": 1, "Y": 2, "Z": 3 } } |
PushMap | void PushMap(const FString& EventName, const TMap<FString, FString>& Pairs) | flat { "k1": "v1", "k2": "v2" } (no envelope; key order non-deterministic) |
PushRaw | void PushRaw(const FString& EventName, const FString& JsonData) | <JsonData> verbatim |
Parameters (all helpers)
| Param | Type | Required | Notes |
|---|---|---|---|
EventName | FString | yes | Case-sensitive; matches React window.ue.bridge.on(EventName, ...) |
Value / Pairs / JsonData | varies | yes | Wrapped under value for typed helpers; passed through verbatim for PushMap / PushRaw |
Returns — void. Push helpers fire-and-forget; there is no synchronous ack.
WARNING
PushMap emits a flat object — there is no value envelope. React clients must read keys by name, not iterate by index, because key order on the wire is non-deterministic.
WARNING
PushRaw does not validate JSON. Malformed input will reach the React side and fail to parse — see /reference/types#fbridgeerrorinfo (JSONParseError).
TIP
PushStruct is C++ only — it's a header-only template, not UFUNCTION-exposed:
template<typename T>
void PushStruct(const FString& EventName, const T& Value);It uses FJsonObjectConverter::UStructToJsonObjectString under the hood and wraps the resulting object under "value". From Blueprint, hand-build the JSON and use PushRaw.
Example
ReactBridgeSender (component)
TargetBridgeName: "HpBar"
Tick (every 100ms)
└─ PushFloat
EventName: "player:health"
Value: CurrentHP / MaxHP// C++ equivalent
Sender->TargetBridgeName = TEXT("HpBar");
Sender->PushFloat(TEXT("player:health"), CurrentHP / MaxHP);See also
/guide/push-data— patterns for game-to-React data flow/reference/bridge-protocol#typed-payload-conventions— wire format details/reference/bp-receiver— the reverse direction (React → UE)