question

CodeHunter avatar image
CodeHunter asked

[VERY URGENT] Unity Matchmaking with Mirror cannot connect to server

I'm currently developing a title requiring a matchmaking service to connect two players to fight each other in an arena battle. So far I can call the matchmaking service up until the players are presented with the IP address of the server and port to connect to. Once I get to that part, the message is stuck with 'sending Handshake to other end' even after leaving it for hours. I checked the custom server in PlayFab connected to the matchmaking service and I have 4 standby servers and none of them has players connected.

What went wrong???

I've tried deploying the server build from

https://github.com/PlayFab/MpsSamples. Still cannot connect and stuck on that same message. I tried starting a fresh project with the latest version of Mirror from the Unity Asset Store and copied the server code from the same repo and it's still giving me the same result. I tried putting some code to update the player title data when connected but it's not being called at all because the player isn't connected. I tried using both UDP and TCP but I still can't get the client to connect.

I need some answers and fast!

unity3dCloudScriptmultiplayerMatchmaking
10 |1200

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

CodeHunter avatar image
CodeHunter answered

I've managed to get it to work, even if the design itself still needs fixing on my end.


I'm still not sure why the server API doesn't work on the server when I can call it just fine from the editor, but I already found a workaround for this one.

The things I did to get it to work:

  1. Remove the server API call (I used client API calls from the client side after the server 'tells' the client to do so)
  2. Check when you start the server (I used to call StartServer() twice in a single runtime, from the Awake() function and from agent activation)
  3. The player number count and the Application.Quit() actually works, I just didn't call them on the correct places. The function to update the server about the player change was there already, but I didn't call it.
10 |1200

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

Gosen Gao avatar image
Gosen Gao answered

I have done a test on that sample, and it works fine for me. Since I don't know the details of how you built the server. Could you please deploy your server build locally by following -- Locally debugging game servers and integration with PlayFab to see if you still have this issue? If you still have the issue, please check some debugging tips here MpsSamples/Debugging.md at master PlayFab/MpsSamples (github.com) and try to confirm the cause of the issue. If it works fine locally, could you tell me how you configure the ports when you create your server build in Game Manager?

4 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.

CodeHunter avatar image CodeHunter commented ·

I tried debugging locally, except the server won't even run in local. I did put a PlayFab server API call in the server as my way of 'debugging' the server and so far it's the reason why my clients can't connect. I took the call out and the client can connect, but I need the server to be able to call server APIs to push data to players after the match is over (will put in a separate question later).

So far the client is connected, but on the server it still shows 0 players connected. Any reason why, or is this behavior actually expected?

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao CodeHunter commented ·

When the client is connected successfully, you need to communicate with PlayFab to update the current players‘ info. You can check Giving PlayFab information about your game server for more information. As for calling server API issue, we will talk to you in the new thread you post.

0 Likes 0 ·
CodeHunter avatar image CodeHunter Gosen Gao commented ·

Sorry for the late response. I've managed to get the API call working now in local, but I haven't tested it out in live server just yet. I'll take a look at the link you gave me because it's quite important now along with putting the active server to either on standby or terminating it after the game ends. Seems like the server is still active even after I called Application.Quit() after the game ends and I don't want to be billed for the servers I'm no longer using.

0 Likes 0 ·
Show more comments

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.