Skip to content

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

PropertyTypeCategoryNotes
TargetBridgeNameFString (EditAnywhere, BlueprintReadWrite)React BridgeRoutes 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.

HelperSignatureevent.detail shape
PushFloatvoid PushFloat(const FString& EventName, float Value){ "value": 75 }
PushIntvoid PushInt(const FString& EventName, int32 Value){ "value": 42 }
PushStringvoid PushString(const FString& EventName, const FString& Value){ "value": "alice" }
PushBoolvoid PushBool(const FString& EventName, bool Value){ "value": true }
PushVectorvoid PushVector(const FString& EventName, FVector Value){ "value": { "X": 1, "Y": 2, "Z": 3 } }
PushMapvoid PushMap(const FString& EventName, const TMap<FString, FString>& Pairs)flat { "k1": "v1", "k2": "v2" } (no envelope; key order non-deterministic)
PushRawvoid PushRaw(const FString& EventName, const FString& JsonData)<JsonData> verbatim

Parameters (all helpers)

ParamTypeRequiredNotes
EventNameFStringyesCase-sensitive; matches React window.ue.bridge.on(EventName, ...)
Value / Pairs / JsonDatavariesyesWrapped under value for typed helpers; passed through verbatim for PushMap / PushRaw

Returnsvoid. 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:

cpp
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

text
ReactBridgeSender (component)
  TargetBridgeName: "HpBar"

Tick (every 100ms)
  └─ PushFloat
       EventName: "player:health"
       Value:     CurrentHP / MaxHP
cpp
// C++ equivalent
Sender->TargetBridgeName = TEXT("HpBar");
Sender->PushFloat(TEXT("player:health"), CurrentHP / MaxHP);

See also

Released under the MIT License.