receive WebSocket messages from player using pixel streaming

Hi everyone,

I’m currently experimenting with pixel streaming and I want to see if it’s possible to receive websocket messages from the cirrus webserver. The catch is that emitUIInteraction seems to be using the WebRTC channel and in my case, I want to be able to send and receive messages using the websocket connection of the streamer at port :8888.

I think I know how to send a message from the cirrus webserver to the streamer, but I don’t know how to read the message using BluePrints and how to respond back to the webserver.

What am I missing?

Many thanks,
Nick

Hi there Nick!

Unfortunately there isn’t any way to achieve the result you’re looking for at this stage.

You can easily set up sending commands from UE to the browser and vice versa, using blueprint setup and the emitUIInteraction, but we don’t currently have any elements for sending messages directly to the signalling server.

It’s an interesting use case however. Are you able to share more information on the intended outcome?

I have a similar use case! I am trying to send a message to reset my level when a player disconnects. I don’t need the streamer to be able to communicate back. Any idea of the easiest way to potentially accomplish this? So far here’s my code attempt trying to make the equivalent of emitUIInteraction on the frontend for cirrus.js:

function sendMyOwnMessage(message) {
	streamers.size && streamers.entries().next().value[1].ws.send(JSON.stringify({type: "UIInteraction", message: message}));
}


@MWillWallT
any ideas on how this could be done?

Hi there!

I believe if you refer to this link: Interacting With the Pixel Streaming System in Unreal Engine | Unreal Engine 5.4 Documentation | Epic Developer Community

You’ll want to use the OnAllConnectionsClosed delegate. This should allow you to achieve the result you’re looking for!

1 Like