Matchmaking in JS, send users to Unity


I am making a game in unity and wanted to make a game client that loads it up. I have an electron + angular app that I code in JS/TS. It handles authentication, out of game store, etc. It is able to obtain a custom JWT token and pass that to my unity client, which uses this to get user info from another service I have.

What I'd like to do is handle matchmaking within my JS app and once the match has been found and players have selected their loadout, send them to unity with the photon game id and any connection information needed.

I've been looking through the realtime JS sdk docs, and it just looks like chat and load balancing is there. Alternatively, if there was a RESTful api, I could make calls to that.

Is such a thing possible?


  • UPDATE: I may have misunderstood what matchmaking was. I think matchmaking is a function of the LoadBalancing Client?

    In either case, the JS examples are somewhat sparse, and the TS examples are non existent. I managed to get the JS into my Angular app, but the typings file seems to be causing issues:

    Additionally, I am able to get to the state "ConnectedToMaster" but I'm not sure where to go from there. The example app then joins lobby, but mine doesn't get that far...

    Operation 229 error: Unknown operation code (-2)

  • vadim
    vadim mod
    edited November 2020
    Matchmaking is a Loadbalancing (Realtime) client feature allowing to chose a room basing on some parameters. The result of matchmaking is the client joined to the room. It's not possible to transfer this information to another client and let it join instead. But you can try to leave (suspend) the room on the js client and rejoin with the sane player id on the other.
    Typescript is the primary language for Photon JS SDK. Classes are defined in module Photon and its submodules. We did not test Angular integration.
    Of course you can always use Photon as js SDK. In this case you can access Photon objects via Photon global variable.
    Operation 229 error means that the client tries to automatically join the lobby (where matchmaking occurs) while being connected to the master server and fails. So maybe the client is connected to the wrong server. How do you join? Do you use nameserver?