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 === '') {  
          const data = JSON.parse(
          // handle pixel streaming message
          if (data.type === 'ps') {
            const psMessage = data.message