Photon Unity Networking 2 2.45

Public Member Functions | Public Attributes | Properties | List of all members
ChatChannel Class Reference

A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY. More...

Public Member Functions

 ChatChannel (string name)
 Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe. More...
 
void Add (string sender, object message, int msgId)
 Used internally to add messages to this channel. More...
 
void Add (string[] senders, object[] messages, int lastMsgId)
 Used internally to add messages to this channel. More...
 
void TruncateMessages ()
 Reduces the number of locally cached messages in this channel to the MessageLimit (if set). More...
 
void ClearMessages ()
 Clear the local cache of messages currently stored. This frees memory but doesn't affect the server. More...
 
string ToStringMessages ()
 Provides a string-representation of all messages in this channel. More...
 

Public Attributes

readonly string Name
 Name of the channel (used to subscribe and unsubscribe). More...
 
readonly List< string > Senders = new List<string>()
 Senders of messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x]. More...
 
readonly List< object > Messages = new List<object>()
 Messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x]. More...
 
int MessageLimit
 If greater than 0, this channel will limit the number of messages, that it caches locally. More...
 
int ChannelID
 Unique channel ID. More...
 
readonly HashSet< string > Subscribers = new HashSet<string>()
 Subscribed users. More...
 

Properties

bool IsPrivate [get, set]
 Is this a private 1:1 channel? More...
 
int MessageCount [get]
 Count of messages this client still buffers/knows for this channel. More...
 
int LastMsgId [get, protected set]
 ID of the last message received. More...
 
bool PublishSubscribers [get, protected set]
 Whether or not this channel keeps track of the list of its subscribers. More...
 
int MaxSubscribers [get, protected set]
 Maximum number of channel subscribers. 0 means infinite. More...
 

Detailed Description

A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.

Contains messages and senders to use (read!) and display by your GUI. Access these by: ChatClient.PublicChannels ChatClient.PrivateChannels

Constructor & Destructor Documentation

◆ ChatChannel()

ChatChannel ( string  name)

Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe.

Member Function Documentation

◆ Add() [1/2]

void Add ( string  sender,
object  message,
int  msgId 
)

Used internally to add messages to this channel.

◆ Add() [2/2]

void Add ( string[]  senders,
object[]  messages,
int  lastMsgId 
)

Used internally to add messages to this channel.

◆ ClearMessages()

void ClearMessages ( )

Clear the local cache of messages currently stored. This frees memory but doesn't affect the server.

◆ ToStringMessages()

string ToStringMessages ( )

Provides a string-representation of all messages in this channel.

Returns
All known messages in format "Sender: Message", line by line.

◆ TruncateMessages()

void TruncateMessages ( )

Reduces the number of locally cached messages in this channel to the MessageLimit (if set).

Member Data Documentation

◆ ChannelID

int ChannelID

Unique channel ID.

◆ MessageLimit

int MessageLimit

If greater than 0, this channel will limit the number of messages, that it caches locally.

◆ Messages

readonly List<object> Messages = new List<object>()

Messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].

◆ Name

readonly string Name

Name of the channel (used to subscribe and unsubscribe).

◆ Senders

readonly List<string> Senders = new List<string>()

Senders of messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].

◆ Subscribers

readonly HashSet<string> Subscribers = new HashSet<string>()

Subscribed users.

Property Documentation

◆ IsPrivate

bool IsPrivate
getset

Is this a private 1:1 channel?

◆ LastMsgId

int LastMsgId
getprotected set

ID of the last message received.

◆ MaxSubscribers

int MaxSubscribers
getprotected set

Maximum number of channel subscribers. 0 means infinite.

◆ MessageCount

int MessageCount
get

Count of messages this client still buffers/knows for this channel.

◆ PublishSubscribers

bool PublishSubscribers
getprotected set

Whether or not this channel keeps track of the list of its subscribers.