can I use a single port to connect to websocket

Hello.
as I know photon in webgl connects as follows
1. conect to "master" port 9090
2. conect to "game" port 9091

how can I make it so that I can connect to photon server using only one port, for example 9090

Tkanks

Comments

  • Hi @Davit,

    Thank you for choosing Photon!

    By design this is how Photon works, each server application is listening to a different port.
    The alternative is to modify or make your own server application but this is not recommended and not an easy task to do.
  • Hi @Davit.

    Actually the port should be a simple setting in the config file that you can change yourself for the self-hosted option and that we could change for you on Photon Enterprise Cloud.

    @chvetsov should be able to tell you where to find this config setting (the config file name and the name of the setting itself)

    Obviously changing the port setting to the same value for multiple server types has two implications:
    - you need to include the port in the server address that you supply in the Photon Client APIs, as otherwise the Photon client will assume that the server is using the default port config
    - you can no longer host servers of different types (i.e. one master + one game server) on the same machine, because the Photon server software that is running on that machine would not know which server instance a clients wants to talk to if multiple Photon servers run on the same machine and listen to the same port

    As you are not mentioning a name server, but only master and game servers, I assume that you are talking about a self-hosted Photon Server 4. Is that correct?
  • hi, @David

    yes, you should be able to use web sockets with one port. To get this working you have to modify your photon server config file and during connection set application name that you want to reach

    in photon server config you have to replace:
    ```
    <WebSocketListeners>
    <WebSocketListener
    IPAddress="0.0.0.0"
    Port="9090"
    DisableNagle="true"
    InactivityTimeout="10000"
    OverrideApplication="Master">
    </WebSocketListener>

    <WebSocketListener
    IPAddress="0.0.0.0"
    Port="9091"
    DisableNagle="true"
    InactivityTimeout="10000"
    OverrideApplication="Game">
    </WebSocketListener>

    </WebSocketListeners>

    ```
    with
    ```
    <WebSocketListeners>
    <WebSocketListener
    IPAddress="0.0.0.0"
    Port="9090"
    DisableNagle="true"
    InactivityTimeout="10000">
    </WebSocketListener>

    </WebSocketListeners>

    ```

    See that OverrideApplication is removed. On the client side you have to set correct application name 'Master' when you want to connect to master and 'Game' when you want connect to game server.

    I have to admit that I do not know how it will work if you are using LoadBalancing/Realtime API on the client. I do not what is going on there

    best,
    ilya
Sign In or Register to comment.