Receiving messages
Receiving messages on the webpage
Pixel stream messages from Unreal Engine will be transmitted utilizing the MessageChannel API. Parse the message string to facilitate data extraction. Each message will contain two properties: type
, which is consistently set to ps
, and message
, encapsulating the data that has been received from Unreal Engine.
function onMessage(event: Event) {
if (event.origin === 'https://app.odyssey.stream') {
const data = JSON.parse(event.data)
// handle pixel streaming message
if (data.type === 'ps') {
const psMessage = data.message
}
}
}
Updated 27 days ago