I’m trying to send messages from a UE5.5 app to the user’s browser. I couldn’t get this to work with my project so I then tried to start with the Pixel Streaming Demo project.
As far as I am aware, I am setting the response emitter and listener up correctly as it is said in the documentation.
In the Player Controller blueprint (BP_Orbit_Controller) I added this:
I then packaged the game in shipping mode and set up the Pixel Streaming frontend. I slightly altered the default player.ts in the typescript frontend implementation by adding this line:
stream.addResponseEventListener('responseListener', (response: string) => {
console.log('Response: ', response);
});
so the full player.ts file looks like this:
// Copyright Epic Games, Inc. All Rights Reserved.
import { Config, PixelStreaming, Logger, LogLevel } from '@epicgames-ps/lib-pixelstreamingfrontend-ue5.5';
import { Application, PixelStreamingApplicationStyle } from '@epicgames-ps/lib-pixelstreamingfrontend-ui-ue5.5';
const PixelStreamingApplicationStyles =
new PixelStreamingApplicationStyle();
PixelStreamingApplicationStyles.applyStyleSheet();
// expose the pixel streaming object for hooking into. tests etc.
declare global {
interface Window { pixelStreaming: PixelStreaming; }
}
document.body.onload = function() {
Logger.InitLogging(LogLevel.Warning, true);
// Create a config object
const config = new Config({ useUrlParams: true });
// Create a Native DOM delegate instance that implements the Delegate interface class
const stream = new PixelStreaming(config);
stream.addResponseEventListener('responseListener', (response: string) => {
console.log('Response: ', response);
});
const application = new Application({
stream,
onColorModeChanged: (isLightMode) => PixelStreamingApplicationStyles.setColorMode(isLightMode)
});
document.body.appendChild(application.rootElement);
window.pixelStreaming = stream;
}
}
What I would expect to happen is when I connect to the stream and press “1”, then in the console I should see “response: ping” printed. However, I do not see such a message.
What am I doing wrong? I’m also open to CPP solutions