// ---------------------------------------------------------------------------------------------------------------------- // The Photon Chat Api enables clients to connect to a chat server and communicate with other clients. // ChatClient is the main class of this api. // Photon Chat Api - Copyright (C) 2014 Exit Games GmbH // ---------------------------------------------------------------------------------------------------------------------- namespace Photon.Chat { using ExitGames.Client.Photon; /// /// Callback interface for Chat client side. Contains callback methods to notify your app about updates. /// Must be provided to new ChatClient in constructor /// public interface IChatClientListener { /// /// All debug output of the library will be reported through this method. Print it or put it in a /// buffer to use it on-screen. /// /// DebugLevel (severity) of the message. /// Debug text. Print to System.Console or screen. void DebugReturn(DebugLevel level, string message); /// /// Disconnection happened. /// void OnDisconnected(); /// /// Client is connected now. /// /// /// Clients have to be connected before they can send their state, subscribe to channels and send any messages. /// void OnConnected(); /// The ChatClient's state changed. Usually, OnConnected and OnDisconnected are the callbacks to react to. /// The new state. void OnChatStateChange(ChatState state); /// /// Notifies app that client got new messages from server /// Number of senders is equal to number of messages in 'messages'. Sender with number '0' corresponds to message with /// number '0', sender with number '1' corresponds to message with number '1' and so on /// /// channel from where messages came /// list of users who sent messages /// list of messages it self void OnGetMessages(string channelName, string[] senders, object[] messages); /// /// Notifies client about private message /// /// user who sent this message /// message it self /// channelName for private messages (messages you sent yourself get added to a channel per target username) void OnPrivateMessage(string sender, object message, string channelName); /// /// Result of Subscribe operation. Returns subscription result for every requested channel name. /// /// /// If multiple channels sent in Subscribe operation, OnSubscribed may be called several times, each call with part of sent array or with single channel in "channels" parameter. /// Calls order and order of channels in "channels" parameter may differ from order of channels in "channels" parameter of Subscribe operation. /// /// Array of channel names. /// Per channel result if subscribed. void OnSubscribed(string[] channels, bool[] results); /// /// Result of Unsubscribe operation. Returns for channel name if the channel is now unsubscribed. /// /// If multiple channels sent in Unsubscribe operation, OnUnsubscribed may be called several times, each call with part of sent array or with single channel in "channels" parameter. /// Calls order and order of channels in "channels" parameter may differ from order of channels in "channels" parameter of Unsubscribe operation. /// Array of channel names that are no longer subscribed. void OnUnsubscribed(string[] channels); /// /// New status of another user (you get updates for users set in your friends list). /// /// Name of the user. /// New status of that user. /// True if the status contains a message you should cache locally. False: This status update does not include a message (keep any you have). /// Message that user set. void OnStatusUpdate(string user, int status, bool gotMessage, object message); /// /// A user has subscribed to a public chat channel /// /// Name of the chat channel /// UserId of the user who subscribed void OnUserSubscribed(string channel, string user); /// /// A user has unsubscribed from a public chat channel /// /// Name of the chat channel /// UserId of the user who unsubscribed void OnUserUnsubscribed(string channel, string user); /// /// Received a broadcast message /// /// Name of the chat channel /// Message data void OnReceiveBroadcastMessage(string channel, byte[] message); } }