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