Show Sidebar

3.4 to 4.0 Upgrade Guide

Overview of Major Changes

The main breaking change between 3.4 and 4.0 is the introduction of new peer classes.

In Photon 3, there were two different classes of peers:

  1. PeerBase: base class for any inbound connection with a Photon client.
  2. ServerPeerBase: base class for any connection with a Photon server.

In Photon 4, those two classes should be replaced by their appropriate new substitute:

  1. ClientPeer: replaces PeerBase.
  2. S2SPeerBase: base server-to-server class that replaces ServerPeerBase.
  3. InboundS2SBase: should replace ServerPeerBase on the server accepting incoming connections.
  4. OutboundS2SBase: should replace ServerPeerBase on the server actively initiating connections.

InboundS2SBase vs. OutboundS2SBase

To better handle disconnections and edge cases, base S2S class is split into two classes.

Photon Server A --> Photon Server B

  • In Server A, the recommended way is to use OutboundS2SBase. Server A actively initializes the connection. In Photon 3, to setup outgoing connections the method used was one of the ApplicationBase.ConnectXXX family. Although this is still possible in v4, we do recommend switching to the new OutboundS2SBase.ConnectXXX.

  • In Server B you should use InboundS2SBase Server B, listens and waits for incoming connection from Server A. That is why in InoundS2SBase the constructor has InitResponse parameter.

Photon v3 Photon v4 Type of peer
PeerBase ClientPeer Any class that should communicate with a client on the other endpoint should extend from ClientPeer.
ServerPeerBase InboundS2SBase Any class that should setup an inbound connection with another Photon server should extend from InboundS2SBase
ServerPeerBase OutboundS2SBase The new and recommended way is to extend OutboundS2SBase when creating a class that should setup an outbound connection with another Photon server.
ServerPeerBase S2SPeerBase The old way of creating a class that should setup an outbound connection with another Photon server is to extend S2SPeerBase.

License Updates and Upgrades

When upgrading to a new major version of the Photon SDK or when using an older SDK version with a newly purchased license file, you should make sure ahead of time before going into production, that your Photon SDK runs with that license.

The easiest way to do this is to put the license file in question into the Photon SDK folder you plan to use and start Photon via the Photon Control application. You should then check the license information shown in the tray app and additionally check the logs for licensing errors.

 To Document Top