Photon Chat Intro
Keep your users communicating while they are online using Photon Chat. Photon Chat applications need a distinct application and AppId to connect to.
To get updates and messages, your application has to implement several methods that are used as callback.
Connect() is passed the version, an arbitrary string, and the username, a unique name in best case.
To keep the connection alive and to get incoming messages continuously call:
Subscribe To Public Channels
With Photon Chat you use public channels to group users or topics. Anyone who subscribes to a public 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.
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.
Send a private message to any user with:
To handle incoming public messages from all subscribed public channels you need a proper chat listener callback:
To receive and parse private messages you implement the following chat listener callback:
Set the online status for your players and an optional status message with:
Define your own statuses using integers.
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: