Show Sidebar

Photon Chat Intro

Get Started

Keep your users communicating while they are online using Photon Chat. Photon Chat applications need a distinct application and AppId to connect to.

Get your AppId from the Chat Dashboard after free signup .

Connect

To get updates and messages, your application has to implement several methods that are used as callback.

Aside AppId, Connect() is passed the version, an arbitrary string, and the username, a unique name in best case.

Subscribe

With Photon Chat you use channels to group users or topics. Anyone who subscribes to a channel gets all messages published within. New channels are created upon first subscription.

The subscribe method is passed an array of strings for the channels to be subscribed.

In some SDKs, to keep the connection alive and to get incoming messages continuously call:

That way you know when to expect new messages.

In the latest versions of the C# SDKs this is no longer required.

Send

Public Messages

Prior to publishing subscribe to the channel you want to publish messages in. Publish messages to all subscribers of a channel with:

Other than plain strings Photon Chat allows you to define complex messages, e.g. for invitations.

Private Messages

Send a private message to any user with:

Receive

Public Messages

To handle incoming public messages you need a proper chat listener callback:

Private Messages

To receive and parse private messages you implement the following chat listener callback:

Online Status

Own Status

Set the online status for your players and an optional status message with:

Define your own statuses using integers.

Friends Status

Just send an array of usernames to Photon to get their future status updates.

You'll receive updates with the current status per friend to the implemented callback:

 To Document Top