Photon Server API
Public Member Functions | List of all members
ExitGames.Messaging.Channels.SubscriptionContainer Class Reference

A container for IChannel<T> subscriptions with a topic. More...

Inheritance diagram for ExitGames.Messaging.Channels.SubscriptionContainer:

Public Member Functions

void Add (string topic, IDisposable unsubscriber)
 Adds a subscription. More...
 
bool Contains (string topic)
 Checks whether a subscription for a topic exists. More...
 
string[] GetTopics ()
 Gets all subscribed topics. More...
 
bool Subscribe< T > (string topic, Concurrency.Channels.IChannel< T > channel, IFiber executor, Action< T > action)
 Subscribes to a channel with a topic. This method first unsubscribes from topic if necessary. More...
 
bool Unsubscribe (string topic)
 Unsubscribes from a topic. More...
 
void Dispose ()
 Disposes all subscriptions. More...
 

Detailed Description

A container for IChannel<T> subscriptions with a topic.

Instance members are not thread safe.

Member Function Documentation

void ExitGames.Messaging.Channels.SubscriptionContainer.Add ( string  topic,
IDisposable  unsubscriber 
)
inline

Adds a subscription.

Parameters
topicThe topic.
unsubscriberThe subscription.
bool ExitGames.Messaging.Channels.SubscriptionContainer.Contains ( string  topic)
inline

Checks whether a subscription for a topic exists.

Parameters
topicThe topic.
Returns
True if a subscription was found.
void ExitGames.Messaging.Channels.SubscriptionContainer.Dispose ( )
inline

Disposes all subscriptions.

string [] ExitGames.Messaging.Channels.SubscriptionContainer.GetTopics ( )
inline

Gets all subscribed topics.

Returns
A list of all subscribed topics.
bool ExitGames.Messaging.Channels.SubscriptionContainer.Subscribe< T > ( string  topic,
Concurrency.Channels.IChannel< T >  channel,
IFiber  executor,
Action< T >  action 
)
inline

Subscribes to a channel with a topic. This method first unsubscribes from topic if necessary.

Template Parameters
TThe message type.
Parameters
topicThe topic.
channelThe channel.
executorThe execution fiber.
actionThe callback action.
Returns
True if resubscribed, false if subscribed the first time.
bool ExitGames.Messaging.Channels.SubscriptionContainer.Unsubscribe ( string  topic)
inline

Unsubscribes from a topic.

Parameters
topicThe topic.
Returns
True if unsubscribed.