Pass messages to and from Unreal
Your browser application can send and receive messages to Unreal Engine over the Pixel Streaming WebRTC datachannel through Odyssey.
Odyssey provides a message channel, using the MessageChannel API
Setting up a MessageChannel
MessageChannel
In order to send and receive native pixel stream messages, you'll need to create a MessageChannel
on your iframe.
The following code sets up a secure communication channel between the parent window and Odyssey (app.odyssey.stream) using the MessageChannel API.
A new MessageChannel
instance is created when the iframe has reached a loaded state, providing two bidirectional ports: port1
and port2
.
The initial action is taken by the parent window, which subscribes to port2
and then transfers port1
to Odyssey. Odyssey will acknowledges and validates this message, replying with an odyssey ready
message. Once this connection is established, both the parent window and Odyssey gain the capability to exchange messages in both directions.
Last updated