Unreal Communication

This page teaches developers how to send and receive messages between their frontend and the Unreal Engine app using Pixel Streaming's emitUIInteraction and event listeners.

🔄 Communication Flow

The WebSDK allows two-way communication between your frontend and the Unreal Engine application:

Direction
Method / Event
Description

Frontend ➝ Unreal

emitUIInteraction()

Sends data from browser to Unreal Engine

Unreal ➝ Frontend

addResponseEventListener()

Listens for Unreal replies or events

📤 Sending Messages from Frontend to Unreal

Use emitUIInteraction() to trigger logic inside your Unreal app:

appStream.stream.emitUIInteraction({
  message: {
    type: "setColor",
    value: "#FF0000"
  }
});

The structure of this message is up to you — you must handle it in Unreal via Blueprints or C++.

📥 Receiving Messages from Unreal in Frontend

Listen to Unreal responses using addResponseEventListener():

pixelStreaming.addResponseEventListener("handle_responses", (payload) => {
  console.log("Received from Unreal:", payload);
});

🎮 Handling Input in Unreal (Blueprint)

You can refer to our unreal engine documentation for this.

🧠 Best Practices

  • Define a clear messaging structure (e.g., { type, value })

  • Avoid sending too many messages per second — batch where possible

  • Always handle unexpected messages gracefully in Unreal and frontend

Last updated