Begginer questions regarding ports, websockets...


We are integrating Photon in a serius gaming application. Our app is being already used on corporate environments (using another multiplayer engine), with proxies and firewalls. And until today, we faced those problems by manually tunneling the connections (from inside the application, not by using an external application)

We've seen how to change the ports server side, but client side we wasn't able to find anything useful. Furthermore for instance, we've seen in the docs that we should be able to use websockets, but they doesn't seem available for windows builds (our application is W10, iOS, Android and OSX)

This is our biggest concern. If we cannot stablish connections inside corporate environments, we will have to drop the idea of using Photon, and we really don't want do that, as it fits perfectly to our needs in all other aspects.


  • Hi @ffelagund.

    On the client you can simply include the server-port in the address string that you pass to connect. The client side port can not be specified. The servers responses will reach the client on the port on which it initiated the communication.
    With Photon server you can configure the incoming ports on the server side. Outgoing ports can't be specified. The client tries to reach the master server on whatever port you have specified in the address string that you passed in your connect()-call or on the default port for the chosen transport protocol if you have not included a port in the address string at all. For game server connections (which happen automatically whenever you enter a room) the client uses the port that the master server has sent it with the address of the game server.
    On Photon Cloud you can't configure the ports on the server side.

    Websockets are only available for Emscripten (webbrowser builds), Windows Store apps and XB One.
  • Is it possible make the server use only ONE TCP and ONE UDP port? We can easily tunnelize that configuration, but the whole bunch of ports makes things unbearable for us.
    Another question: Looking at the port's list, I can see Game Server 1 and Game Server 2 ports for each protocol. What is the second one used for? Is it mandatory?

  • Hi @ffelagund.

    On Photon Cloud it is not possible to change the ports on which the servers are listening.

    With a self hosted server there is one port per protocol for the master server and one for the game servers in a normal live config. The reason for the game servers using a different port than the master is so that one can run one game server on the same machine as the master server.

    The default development setup uses another port for a second game server, so that one can test with 2 game servers on one physical machine. This way you can even run the Photon server on your local dev machine an connect to it via localhost and still can test with a multi game server setup.

    As in production environments one would only add another game server once the amount of clients becomes to big for one game server to handle, naturally one would not run more than one game server per physical server machine.
    Hence in production using the same port for all game servers is fine.

    If you don't share one machine between the master server and one of the game servers, then is should be totally fine to use the same port for the master server and for all game servers, as the only hard reason for using multiple different ports is to make it possible to run multiple server instances on one machine.