"Message was missing target player and target group" when group is set and player is joined to group

Hi all,

I’m walking through the frog tutorial for Unity and have client -> server messaging working, but server -> client messaging gives the following error in the server logs on the EC2 instance:

18 Nov 2020 09:09:55,193 [ERROR] (index.js) 371: Message was missing a target player and target group. Message: {“opCode”:777,“sender”:-1,“payload”:{“type”:“Buffer”,“data”:

I’m using the below function to send a “response” message from the server when the client sends a message:

function onMessage(gameMessage) {
const outMessage = session.newTextGameMessage(777,
“A test message from the server”);
session.sendGroupMessage(outMessage, 0);

My understanding is I’m sending to group “0”. My client code should be registered to group “0” using the below code:

// Initiate a connection with the Realtime server with the given connection information
Client.Connect(endpoint, remoteTcpPort, listeningUdpPort, connectionToken);

… so I’m at a complete loss as to why the error claims “missing target group”. I’m sure I’m missing something obvious - any help is much appreciated!


I believe its because group 0 is special. Try using a positive group number

This is based on the comment here: https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-script.html

which says that group number should be positive. AFAIK -1 is all groups and >0 is specific groups. Not sure what group 0 is for.

That was it! pounds head on desk You are awesome, thanks!

I filed a documentation bug on the GameLift docs pages: https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-script.html

Will also reach out to the GameLift team to highlight your problem as maybe they can improve error messages returned in this case etc.