question

Denzie Gray avatar image
Denzie Gray asked

Issue communicating with REST server running on Multiplayer Server

@Brendan @Citrus Yan

Ok so what I’m trying to do is communicate with a rest server running on a multiplayer server.

Here’s where I’m at

// I have obtained the FQDN of the multiplayer server like so

const response = multiplayer.RequestMultiplayerServer({ PreferredRegions: [“EastUS”], SessionId: “some_session_uuid”, BuildId: “some_build_uuid” }); const fdqn = response.FDQN;

The REST Server is listening at http://0.0.0.0:3700/ or http://*:3700 and I am making requests from the serverless node to the rest server like so

const restServerUri = http://${fdqn}:3700/moves/get-legal-moves; const response = http.request(restServerUri, ‘get’, ‘application/json’);
This produces a ’TimeOut’ response

When I went to check that my requests are actually reaching the rest server I observed the stdout logs inside the docker container it’s clear that my get request is never reaching the server.

So I thought we might be using the wrong port.

When I RDP’ed into the windows VM I opened up a terminal w/ admin permission and ran
docker ps
. I noticed that there appear to be external ports mapping requests made to the VM to the ports I added when I made a build.Example:
0.0.0.0:30001 -> 3700/tcp
Where 3700 is the port the rest server should be listening on.

So I changed the restServerUri to http://${fdqn}:3700/moves/get-legal-moves; and I’m still getting a ‘TimeOut’ response and I’ve verified that the request never hits the rest server.

How would I construct the restServerUri using information from the response of the RequestMultiPlayerServer request?

CloudScriptmultiplayerMatchmaking
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

There is a mapping of developer-provided ports (your case is 3700) to the Internet-facing port (returned from RequestMultiplayerServer). You should use the latter to communicate with the rest server hosted on PlayFab, which looks like this:

const restServerUri  = http://${fdqn}:${Internet-facing port}/moves/get-legal-moves
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Denzie Gray avatar image Denzie Gray commented ·

Thank you so much! It seems to be working now.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Denzie Gray commented ·

Great! Please let me know if you have any questions.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.