Having Issues with v5 RC1 Photon Server Connecting to WebGL Unity Game

Hello,

I've been trying to get this server connected to my WebGL Unity game, looking through the forums for about a week, and figured I'd make my own post.

I am hosting a Photon Server (v5 RC1) on a Google Cloud Server, the OS is Windows 2012 Server. Certificates should be all set, the firewall has been set with all relevant ports (9090, 9091, 9093, 19090, 19091, 19093), the HttpListeners in PhotonServer.config has been updated with cert paths, and I added the IPs, domainName, hostName, etc.

Please help!

I'll add my Photonserver config below to start, please let me know if you'd like to see any other files:

<?xml version="1.0" encoding="utf-8"?>
<!--
(c) 2015 by Exit Games GmbH, http://www.exitgames.com
Photon server configuration file.
For details see the photon-config.pdf.

This file contains two configurations:

"LoadBalancing"
Loadbalanced setup for local development:
Starts the apps: NameServer, Game, Master
Listens: udp-port 5055-5056, 5058, 27000-27002, tcp-port: 4520, 4530-4531, 4533, 9090-9091, 9093, 843 and 943

-->

<Configuration>
<!-- Multiple instances are supported. Each instance has its own node in the config file. -->

<Instance Name="LoadBalancing"
MaxMessageSize="512000"
MaxQueuedDataPerPeer="512000"
PerPeerMaxReliableDataInTransit="51200"
PerPeerTransmitRateLimitKBSec="256"
PerPeerTransmitRatePeriodMilliseconds="200"
MinimumTimeout="5000"
MaximumTimeout="30000"
DisplayName="LoadBalancing (MyCloud)">

<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
<!-- Port 5055 is Photon's default for UDP connections. -->
<UDPListeners>
<UDPListener
IPAddress="0.0.0.0"
Port="5055"
OverrideApplication="Master">
</UDPListener>
<UDPListener
IPAddress="0.0.0.0"
Port="27001"
OverrideApplication="Master">
</UDPListener>
<UDPListener
IPAddress="0.0.0.0"
Port="5056"
OverrideApplication="Game">
</UDPListener>
<UDPListener
IPAddress="0.0.0.0"
Port="27002"
OverrideApplication="Game">
</UDPListener>
<UDPListener
IPAddress="0.0.0.0"
Port="5058"
OverrideApplication="NameServer">
</UDPListener>
<UDPListener
IPAddress="0.0.0.0"
Port="27000"
OverrideApplication="NameServer">
</UDPListener>
</UDPListeners>

<!-- 0.0.0.0 opens listeners on all available IPs. Machines with multiple IPs should define the correct one here. -->
<TCPListeners>
<!-- TCP listener for Game clients on Master application -->
<TCPListener
IPAddress="0.0.0.0"
Port="4530"
OverrideApplication="Master"
InactivityTimeout="10000"
>
</TCPListener>

<TCPListener
IPAddress="0.0.0.0"
Port="4531"
OverrideApplication="Game"
InactivityTimeout="10000">
</TCPListener>

<TCPListener
IPAddress="0.0.0.0"
Port="4533"
OverrideApplication="NameServer"
InactivityTimeout="10000">
</TCPListener>

<!-- DON'T EDIT THIS. TCP listener for GameServers on Master application -->
<TCPListener
IPAddress="0.0.0.0"
Port="4520">
</TCPListener>
</TCPListeners>

<!-- Policy request listener for Unity and Flash (port 843) and Silverlight (port 943)
multiple Listeners allowed for different ports -->
<!-- PolicyFiles are now disabled by default and will be deprecated
Uncomment to enable them back
also make sure to add PolicyFile="Policy\assets\socket-policy.xml"
to the TCPListeners if needed -->
<!--
<PolicyFileListeners>
<PolicyFileListener
IPAddress="0.0.0.0"
Port="843"
PolicyFile="Policy\assets\socket-policy.xml">
</PolicyFileListener>
<PolicyFileListener
IPAddress="0.0.0.0"
Port="943"
PolicyFile="Policy\assets\socket-policy-silverlight.xml">
</PolicyFileListener>
</PolicyFileListeners>
-->


<!-- WebSocket (and Flash-Fallback) compatible listener -->

<HTTPListeners>
<HTTPListener
Name="*:[PORT]::Master"
IPAddress="0.0.0.0"
Port="9090"
DisableNagle="true"
InactivityTimeout="10000"
Secure = "true">
<Routing>
<Route
Url="/+"
OverrideApplication="Master"
PeerType="WebSocket"
Counters="false"
/>
</Routing>
<ServerCertificates>
<ServerCertificate Path="C:\Users\chris_brown\Desktop"
Certificate="server.pem">
</ServerCertificate>
</ServerCertificates>
</HTTPListener>

<HTTPListener
Name="*:[PORT]::Game"
IPAddress="0.0.0.0"
Port="9091"
DisableNagle="true"
InactivityTimeout="10000"
AppDataInactivityTimeout="15000"
Secure = "true">
<Routing>
<Route
Url="/+"
OverrideApplication="Game"
PingEvery="2000"
PeerType="WebSocket"
Counters="false"
/>
</Routing>
<ServerCertificates>
<ServerCertificate Path="C:\Users\chris_brown\Desktop"
Certificate="server.pem">
</ServerCertificate>
</ServerCertificates>
</HTTPListener>

<HTTPListener
Name="*:[PORT]::NameServer"
IPAddress="0.0.0.0"
Port="9093"
DisableNagle="true"
InactivityTimeout="10000"
AppDataInactivityTimeout="15000">
<Routing>
<Route
Url="/+"
OverrideApplication="NameServer"
PeerType="WebSocket"
Counters="false"
/>
</Routing>
</HTTPListener>

<!--
<HTTPListener
Name="*:[PORT]"
IPAddress="0.0.0.0"
Port="80"
DisableNagle="true"
InactivityTimeout="10000"
AppDataInactivityTimeout="15000">
<Routing>
<Route
Name="Master"
Url="/master/+"
OverrideApplication="Master"
PeerType="WebSocket"
Counters="true"
/>
<Route
Name="Game"
Url="/game/+"
OverrideApplication="Game"
PingEvery="2000"
PeerType="WebSocket"
Counters="true"
/>
<Route Url="/photon/m" Ping="true" Counters="false"/>
<Route
Name="NameServer"
Url="/+"
OverrideApplication="NameServer"
PeerType="WebSocket"
Counters="false"
/>
<Route Url="/photon/n" Ping="true" Counters="false"/>
</Routing>
</HTTPListener>
-->

<!--
<HTTPListener
Name="*:[PORT]::Master"
IPAddress="0.0.0.0"
Port="19090"
DisableNagle="true"
InactivityTimeout="10000"
Secure = "true">
<Routing>
<Route
Url="/+"
OverrideApplication="Master"
PeerType="WebSocket"
Counters="false"
/>
</Routing>
</HTTPListener>

<HTTPListener
Name="*:[PORT]::Game"
IPAddress="0.0.0.0"
Port="19091"
DisableNagle="true"
InactivityTimeout="10000"
AppDataInactivityTimeout="15000"
Secure = "true">
<Routing>
<Route
Url="/+"
OverrideApplication="Game"
PingEvery="2000"
PeerType="WebSocket"
Counters="false"
/>
</Routing>
</HTTPListener>

<HTTPListener
Name="*:[PORT]::NameServer"
IPAddress="0.0.0.0"
Port="19093"
DisableNagle="true"
InactivityTimeout="10000"
AppDataInactivityTimeout="15000"
Secure="true">
<Routing>
<Route
Url="/+"
OverrideApplication="NameServer"
PeerType="WebSocket"
Counters="false"
/>
</Routing>
</HTTPListener>
-->

<!--
<HTTPListener
Name="*:[PORT]"
IPAddress="0.0.0.0"
Port="443"
DisableNagle="true"
InactivityTimeout="10000"
AppDataInactivityTimeout="15000"
Secure="true">
<Routing>
<Route
Name="Master"
Url="/master/+"
OverrideApplication="Master"
PeerType="WebSocket"
Counters="true"
/>
<Route
Name="Game"
Url="/game/+"
OverrideApplication="Game"
PingEvery="2000"
PeerType="WebSocket"
Counters="true"
/>
<Route Url="/photon/m" Ping="true" Counters="false"/>
<Route
Name="NameServer"
Url="/+"
OverrideApplication="NameServer"
PeerType="WebSocket"
Counters="false"
/>
<Route Url="/photon/n" Ping="true" Counters="false"/>
</Routing>
</HTTPListener>
-->
</HTTPListeners>

<!-- Defines the Photon Runtime Assembly to use. -->
<Runtime
Assembly="PhotonHostRuntime, Culture=neutral"
Type="PhotonHostRuntime.PhotonDomainManager"
UnhandledExceptionPolicy="TerminateProcess">
</Runtime>

<!-- Defines which applications are loaded on start and which of them is used by default. Make sure the default application is defined. -->
<!-- Application-folders must be located in the same folder as the bin_Win64 folders. The BaseDirectory must include a "bin" folder. -->
<Applications Default="NameServer">
<Application
Name="Master"
BaseDirectory="LoadBalancing\Master"
Assembly="Photon.LoadBalancing"
Type="Photon.LoadBalancing.MasterServer.MasterApplication">
</Application>
<Application
Name="Game"
BaseDirectory="LoadBalancing\GameServer"
Assembly="Photon.LoadBalancing"
Type="Photon.LoadBalancing.GameServer.GameApplication">
</Application>

<Application
Name="NameServer"
BaseDirectory="NameServer"
Assembly="Photon.NameServer"
Type="Photon.NameServer.PhotonApp">
</Application>
</Applications>
</Instance>

</Configuration>

Thank you!

Comments

  • hi, @tmm384

    lets start with simple thing. Try to get photon working with either with tcp or udp or WebSockets(non secure)

    In adjacent topic guys managed to connect to 443 port. That means that could be also some settings beside photon and firewall that regulate connections. Azure machines for sure have that

    best,
    ilya
  • Hello @chvetsov ,

    Thanks for responding!

    Yes, I remember seeing that as well. I have that port allowed through the firewall as well, and I get this error when connecting (as I do when attempting to connect with any port):

    v1.01_TEST8.framework.js:2 WebSocket connection to 'ws://portal-beyond.net:443/?libversion=4.1.6.1&sid=30&app=NameServer' failed:

    I believe it might have something to do with my GameServer.xml.config:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <Photon>
    <LoadBalancing>
    <EnablePerformanceCounters>True</EnablePerformanceCounters>
    <GCLatencyMode>Interactive</GCLatencyMode>
    </LoadBalancing>
    <Authentication>
    <AuthCacheUpdateInterval>300</AuthCacheUpdateInterval>
    <AuthTokenKey>76B2814E-2A50-4E29-838A-20411D335FC9</AuthTokenKey>
    <HMACTokenKey>DD6FD4DE-BF09-46A1-833E-ACDC22DD3FC7</HMACTokenKey>
    <AuthTokenExpirationSeconds>3600</AuthTokenExpirationSeconds>
    </Authentication>
    <GameServer>
    <!-- GameServer-to-Master connections. -->
    <!-- Client-to-Gameserver Secure WebSocket connections. Needs to match the secure WebSocketListener in PhotonServer.config -->
    <GamingSecureWebSocketPort>9091</GamingSecureWebSocketPort>

    <!-- the hostname for this gameserver. Required for HTTP & websocket connections. Change it to a useful entry, like hostname.mydomain.com, for a production scenario. -->
    <PublicHostName>photon.portal-beyond.net</PublicHostName>

    <!-- The domain name for this gameserver. Required for websocket connections and needs to match the certificate for secure websocket / https connections. -->
    <PublicDomainName>portal-beyond.net</PublicDomainName>

    <S2S>
    <ConnectRetryInterval>15</ConnectRetryInterval>
    <!-- Set to the IP Address of the Photon instance where your Master application is running. -->
    <MasterIPAddress>10.138.0.2</MasterIPAddress>
    <OutgoingMasterServerPeerPort>4520</OutgoingMasterServerPeerPort>
    </S2S>

    <Master>
    <!-- LB stats - disabled, because vApps use their own app-stats-publishing-mechanism -->
    <AppStatsPublishInterval>1000</AppStatsPublishInterval>

    <GamingWsPath>Game</GamingWsPath>
    <!-- Client-to-Gameserver Secure WebSocket connections. Needs to match the secure WebSocketListener in PhotonServer.config -->
    <GamingSecureWebSocketPort>19091</GamingSecureWebSocketPort>
    <!-- Client-to-Gameserver TCP connections. Needs to match the TCPListener in PhotonServer.config -->
    <GamingTcpPort>4531</GamingTcpPort>
    <!-- Client-to-Gameserver UDP connections. Needs to match the UDPListener in PhotonServer.config -->
    <GamingUdpPort>5056</GamingUdpPort>
    <!-- Client-to-Gameserver WebSocket connections. Needs to match the WebSocketListener in PhotonServer.config -->
    <GamingWebSocketPort>9091</GamingWebSocketPort>

    <PublicIPAddress>10.138.0.2</PublicIPAddress>
    <PublicIPAddressIPv6></PublicIPAddressIPv6>
    <!-- the hostname for this gameserver. Required for HTTP & websocket connections. Change it to a useful entry, like hostname.mydomain.com, for a production scenario. -->
    <PublicHostName>photon.portal-beyond.net</PublicHostName>
    </Master>

    <HttpQueueSettings>
    <MaxErrorRequests>30</MaxErrorRequests>
    <MaxTimedOutRequests>30</MaxTimedOutRequests>
    <HttpRequestTimeout>30000</HttpRequestTimeout>
    <MaxBackoffTime>10000</MaxBackoffTime>
    <MaxQueuedRequests>5000</MaxQueuedRequests>
    <QueueTimeout>90000</QueueTimeout>
    <ReconnectInterval>60000</ReconnectInterval>
    <MaxConcurrentRequests>1</MaxConcurrentRequests>
    <LimitHttpResponseMaxSize>200000</LimitHttpResponseMaxSize>
    </HttpQueueSettings>

    <Limits>
    <Inbound>
    <EventCache>
    <EventsCount>10000</EventsCount>
    <SlicesCount>1000</SlicesCount>
    <ActorEventsCount>10000</ActorEventsCount>
    </EventCache>

    <Properties>
    <MaxPropertiesSizePerGame>51000</MaxPropertiesSizePerGame>
    </Properties>
    <Operations>
    </Operations>
    </Inbound>
    </Limits>


    <EnableNamedPipe>False</EnableNamedPipe>

    <LastTouchSecondsDisconnect>0</LastTouchSecondsDisconnect>
    <MaxEmptyRoomTTL>60000</MaxEmptyRoomTTL>

    <ServerStateFile>ServerState.txt</ServerStateFile>
    <WorkloadConfigFile>Workload.1Gbps.config</WorkloadConfigFile>

    </GameServer>

    <!-- Enable WebRPCs by setting Enabled to "true" -->
    <!-- "BaseUrl" provided is for demo purposes only and must not be used in a live environment or load testing. Change this in production. -->
    <WebRpc Enabled="True">
    <HttpQueueSettings>
    <LimitHttpResponseMaxSize>100000</LimitHttpResponseMaxSize>
    </HttpQueueSettings>
    <BaseUrl>http://localhost:55557/realtime-webhooks-1.2</BaseUrl&gt;
    </WebRpc>
    </Photon>
    </configuration>
  • hi, @tmm384

    first think that I see that you are connecting wss port using 'ws' protocol. so, it will fails for sure. using ws you have to connect to port 80. using wss to 443

    configuration looks good, although are you sure that '10.138.0.2' is public IP but not internal network ip?

    best,
    ilya
  • Hi @chvetsov

    I believe that "10.138.0.2" is the internal IP, and I tried the external IP and had issues as well.

    I actually began using Photon Cloud Servers and configured that correctly, so I won't need any more help with the self-hosted solution.

    I appreciate the help you gave, I'll use it for future solutions.

    Thanks Again,
    Chris