Sign In Register

How can we help you today?

Start a new topic

CreateMatchByID not doing anything

Im testing this on the Test Harness


-I open 2 tabs,

-In one of then I send this event, using the IDs from each tab:

 

{
  "@class": ".LogEventRequest",
  "eventKey": "M_FID",
  "pids": {"arr":["586669a8135f38fb1edc2ff5", "586659c075e7ef6912b44800"]}
}

 

Heres the code for this event:

 

var playersJSON = Spark.getData().pids;

var matchID = Spark.getMultiplayer().createMatchById(playersJSON.arr);
var match = Spark.getMultiplayer().loadMatch(matchID);
match.enableRealtime("RT_QR");

 

Notting happens, I do receive an LogEventResponse with no errors. But no message found responses.

Im obviously missing something here?


I tried requesting a manual match in each tab (maybe it requires both players to be requesting a match?) but nothing changes:


-I open 2 tabs,

-Send the same Matchmakingrequests in both

-In one of then I send the event


Still nothing.



Hi Giuliano,


Creating a match in this way won't result in a MatchFoundMessage. The users added will just be added to the match. If you navigate to NoSql and check the matchInstance collection you'll see this new match exists. The MatchFoundMessage is only sent when a match was successfully made via the match making process. If you're creating matches manually this way you could simply added some code in the send a quick SparkMessage to let each player know that this match has been created. Hopefully that clears up this issue for you.


Regards,

Liam

To start a real time session you need host, port and an access token, those are returned on the MatchFoundMessage.

I can see you can get host and port from the match on the cloud, but theres no access token. How can I start a real time session then?

Hi Giuliano,


Apologies for the delayed response. Once the players have been added to the match in this manner you can send a MatchDetailsRequest with the matches ID. This will return the token required to start the session. If you have any further questions just let me know.


Regards,

Liam

Login to post a comment