Photon Server API
Public Member Functions | Protected Member Functions | List of all members
ExitGames.Messaging.Channels.TopicChannel< T > Class Template Reference

this class is a hybrid between TopicSubscription<T> and TopicPublishChannel<T>: it sends locally published messages through a ISocketSender and receives remote messages through the TopicMessageReceiver More...

Inheritance diagram for ExitGames.Messaging.Channels.TopicChannel< T >:
ExitGames.Messaging.Channels.TopicPublishChannel< T > ExitGames.Messaging.Channels.TopicPublisher< T > ExitGames.Concurrency.Channels.IChannel< T > ExitGames.Concurrency.Channels.IPublisher< T > ExitGames.Concurrency.Channels.ISubscriber< T > ExitGames.Concurrency.Channels.IPublisher< T >

Public Member Functions

 TopicChannel (string topic, Concurrency.Channels.IChannel< T > channel, ISocketSender socketSender, TopicMessageReceiver topicMessageReceiver, IMessageSerializer< T > serializer)
 Initializes a new instance of the TopicChannel<T> class. More...
 
void Dispose ()
 Releases managed and unmanaged resources. More...
 
- Public Member Functions inherited from ExitGames.Messaging.Channels.TopicPublishChannel< T >
 TopicPublishChannel (string topic, Concurrency.Channels.IChannel< T > channel, ISocketSender socketSender, IMessageSerializer< T > serializer, Guid hostId)
 Initializes a new instance of the TopicPublishChannel<T> class. More...
 
IDisposable SubscribeOnProducerThreads (IProducerThreadSubscriber< T > subscriber)
 Subscribes an IProducerThreadSubscriber<T> that is invoked when Publish is called. More...
 
void ClearSubscribers ()
 Removes all subscribers. More...
 
IDisposable Subscribe (IFiber fiber, Action< T > receive)
 Registers a callback on this channel that receives one message at a time. More...
 
IDisposable SubscribeToBatch (IFiber fiber, Action< IList< T >> receive, int intervalInMs)
 Registers a callback on this channel that receives a list of messages. More...
 
IDisposable SubscribeToKeyedBatch< TK > (IFiber fiber, Converter< T, TK > keyResolver, Action< IDictionary< TK, T >> receive, int intervalInMs)
 Registers a callback on this channel that receives a dictionary of messages. More...
 
IDisposable SubscribeToLast (IFiber fiber, Action< T > receive, int intervalInMs)
 Registers a callback on this channel that receives the last message after a timeout. More...
 
- Public Member Functions inherited from ExitGames.Messaging.Channels.TopicPublisher< T >
 TopicPublisher (string topic, Concurrency.Channels.IPublisher< T > publisher, ISocketSender socketSender, IMessageSerializer< T > serializer, Guid hostId)
 Initializes a new instance of the TopicPublisher<T> class. More...
 
void SendToSocket (T message)
 The message is serialized with the IMessageSerializer<T> and then sent as TopicMessage to the ISocketSender. More...
 
bool Publish (T msg, Guid theHostId)
 publishes the message in the underlying topic and calls SendToSocket if the given hostId is the local host id (see constructor) More...
 
bool Publish (T msg)
 publishes the message in the underlying topic and calls SendToSocket More...
 
- Public Member Functions inherited from ExitGames.Concurrency.Channels.ISubscriber< T >
IDisposable SubscribeToKeyedBatch< K > (IFiber fiber, Converter< T, K > keyResolver, Action< IDictionary< K, T >> receive, int intervalInMs)
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Releases managed and unmanaged resources. More...
 

Additional Inherited Members

- Properties inherited from ExitGames.Messaging.Channels.TopicPublishChannel< T >
Concurrency.Channels.IChannel< T > UnderlyingChannel [get]
 Gets the wrapped Concurrency.Channels.IChannel<T>. More...
 
- Properties inherited from ExitGames.Messaging.Channels.TopicPublisher< T >
Guid HostId [get]
 Gets the host id. The host id is added to each TopicMessage to enable the TopicMessageReceiver to filter messages on the same host. More...
 
IMessageSerializer< T > MessageSerializer [get]
 Gets the message serializer. The serializer converts a message to a byte array before sending them to the socket. More...
 
string Topic [get]
 Gets the topic. The topic is used to distinguish between different message types that are received and sent on the same socket. More...
 
Concurrency.Channels.IPublisher< T > UnderlyingPublisher [get]
 Gets the underlying publisher which is usally a Channel<T>. More...
 

Detailed Description

this class is a hybrid between TopicSubscription<T> and TopicPublishChannel<T>: it sends locally published messages through a ISocketSender and receives remote messages through the TopicMessageReceiver

Template Parameters
Tthe type of message

all instance members are thread safe if all constructor parameters are thread safe, too

Constructor & Destructor Documentation

ExitGames.Messaging.Channels.TopicChannel< T >.TopicChannel ( string  topic,
Concurrency.Channels.IChannel< T >  channel,
ISocketSender  socketSender,
TopicMessageReceiver  topicMessageReceiver,
IMessageSerializer< T >  serializer 
)
inline

Initializes a new instance of the TopicChannel<T> class.

Parameters
topicThe topic.
channelThe channel.
socketSenderThe socket sender.
topicMessageReceiverThe topic Message Receiver.
serializerThe message serializer.

Member Function Documentation

void ExitGames.Messaging.Channels.TopicChannel< T >.Dispose ( )
inline

Releases managed and unmanaged resources.

virtual void ExitGames.Messaging.Channels.TopicChannel< T >.Dispose ( bool  disposing)
inlineprotectedvirtual

Releases managed and unmanaged resources.

Parameters
disposingTrue if called from Dispose(), false if called from destructor.