Show Sidebar

Realtime Intro

Get Started

Photon Realtime is a fully managed service (SaaS) of Photon on-premises servers running in regions worldwide, ready for low latency multiplayer gaming around the globe, anytime.

Use the LoadBalancing API to match players to a shared game session (called "room") and transfer messages synchronously, in real-time, between connected players across platforms. All client SDKs can interact with each other, no matter if iOS, Android, web, console or standalone.


Photon Realtime applications need a distinct application and AppId to connect to. Get your AppId from the Realtime Dashboard after free signup.

With an AppId at hand you are ready to create a LoadBalancingClient instance and call ConnectToRegionMaster.

Simply set your AppId and pick a region to connect to by using ConnectToRegionMaster. Click here for a list of available regions.

It is best practice to extend the LoadBalancingClient to modify callbacks and react to updates coming from the server. This is shown in the demos.

Call Service

The LoadBalancing API is built to integrate well with your game logic. You can fine-control when you want to handle incoming messages and how often you send anything. Internally, both directions are buffered until your game calls LoadBalancingClient.Service().

Service() internally calls DispatchIncomingCommands() until it returns false to dispatch all received incoming messages into your game logic. Calling Service() triggers the callbacks OnEvent, OnOperationResponse, etc. Service() also calls SendOutgoingCommands which actually sends operations that your client called since the last SendOutgoingCommands.

Games often use a game loop which calculates updates and then refreshes the screen. Call Service() 10 to 20 times per second. If you don't call it, no "network progress" gets done at all.


Create a Game

To create a new room, aka game, invoke OpCreateRoom on your connected LoadBalancingClient.

This sets the room name and amount of players (4) that are allowed in the room. The client will enter the new room automatically Rooms exist until the last player left.

You can define RoomOptions.customRoomProperties to set shared values for the room when you create it. The Custom Room Properties can be used (e.g.) to store the map name, level or the round duration. The keys of Custom Properties have to be strings. Of course those values can be set and modified in the room as well.

You can select any of your custom properties to be shown also in the lobby, by setting the optional array with their names in RoomOptions.customRoomPropertiesForLobby. Properties showing in the lobby can be used for matchmaking and as filter for random matches.

The TypedLobby.Default defines that the new room is listed in the Default Lobby. It lists rooms, which can be used for another form of Matchmaking.

Find a Game

Clients join games by name or ask Photon to find a perfect match.

Find rooms ...

  • by Random: Matches players randomly. Optionally fills rooms or distributes players evenly.
  • Use Filters in random matchmaking for better matching.
  • by Listing: The lobby lists visible rooms to let players pick and join manually.
  • that are Private: Join hidden rooms that you know the name of.
  • or Parameterized: Customize random matching by defining expected properties.


Sending Events

Whatever happens on one client can be sent as event to update everyone in the same room.

Update your players with stats, positions or your current turn. Photon will send it as fast as possible (with optional reliability).

  • Send messages/events: Send any type of data to other players.
  • Player/Room properties: Photon updates and syncs these, even to players who join later.

Your event codes should stay below 200. Each code should define the type of event and the content it carries.

The event data in the example above is a Hashtable. It can be a byte[] or basically any data type supported by Photon's serialization (a string, float[], etc.). See Serialization in Photon for more information.

Receiving Events

Whenever an event is dispatched the OnEvent handler is called.

Each event carries its EventData.Code and EventData.Parameters in the way your client sent them. Your application knows which content to expect by the Code passed with the EventData (see above).

For an up-to-date list of default event codes look for the EventCode constants in your SDK, e.g. within ExitGames.Client.Photon.LoadBalancing.EventCode for C#.

Custom or Authoritative Server Logic

As is, without authoritative logic, Photon Cloud products already allow for a broad range of game types.

  • First Person Shooters
  • Racing Games
  • Minecraft type of games
  • Casual real-time games
  • Asynchronous and synchronous games
  • ...

Use Photon Server or Photon Plugins to implement your own custom logic.

Get Support

We, the Photon Team ( sometimes referred to as Photonians :), are dedicated to help you. If you've got questions, curiosities, ... or your app doesn't work but you really wish it would, try any of these:

Get It Faster

For quick turn-arounds please include, together with reproducible steps:

  • Photon Client SDK version
    • This is part of the SDK zip file name.
    • In case of PUN send us the value of: PhotonNetwork.versionPun.
  • Photon Cloud
    • Drop us the AppId and the Game Version which is set via Connect*() call.
    • If you have trouble with some room, send us the RoomName and the Server Address of it. In C#, log client.CurrentServerAddress while in the room
    • Let us know the Region and the Server Address.
  • Photon Server
    • Hosting a Server? Let us know the Server SDK Version. Again, this is part of the SDK zip file name.
    • Add your logs.

Get in Touch

We'd love to know what you want to read and see in our docs, whether that is more demos, specific documentation, an FAQ or example applications. If there's something you'd like to see that's not already in drop us your suggestion to

Want to learn more about Photon?

Get started, Try Free Plan
Find us at these events and venues.
Request a meeting.

 To Document Top