Diffusion Apple API
5.9.24
Unified Client Library for iOS, OS X and tvOS
|
The Messaging feature provides a client session with messaging capabilities.
The Messaging feature for a session can be obtained from the session's messaging
property.
Additional Inherited Members | |
Properties inherited from PTDiffusionFeature | |
PTDiffusionSession * | session |
- (PTDiffusionMessageStream *) addFallbackMessageStreamWithDelegate: | (id< PTDiffusionMessageStreamDelegate >) | delegate |
When a message is received from the server, it will be passed on to all message streams that have been added with matching selectors. If no message stream is registered with a matching selector, the fallback message streams that have been registered using this method will be called instead.
Zero, one, or many fallback message streams can be set. If there is no fallback message stream, messages that match no other will be discarded.
delegate | Receiver of messages stream events not handled by an explicitly registered topic selector. Used by the stream to notify of events but not retained. The delegate will be sent messages asynchronously on the main dispatch queue. |
removeMessageStream:
method is required later on.NSInvalidArgumentException | Raised if the supplied delegate argument is nil . |
- (PTDiffusionMessageStream *) addMessageStreamWithSelector: | (PTDiffusionTopicSelector *) | selector | |
delegate: | (id< PTDiffusionMessageStreamDelegate >) | delegate | |
Add a message stream to receive messages for topics that match the given topic selector.
When a message is received from the server, it will be passed to all message streams that have been added with matching selectors. If there is more than one match, the order in which the message streams are called is not defined. If there is no matching message stream, the fallback message stream will be called instead.
selector | The topic selector to be evaluated locally. |
delegate | Receiver of messages on matching message stream events. Used by the stream to notify of events but not retained. The delegate will be sent messages asynchronously on the main dispatch queue. |
removeMessageStream:
method is required later on.NSInvalidArgumentException | Raised if any supplied arguments are nil . |
- (BOOL) removeMessageStream: | (nullable PTDiffusionMessageStream *) | stream |
Remove a message stream that was previously added using a topic selector or as a fallback.
stream | The stream to remove. |
YES
if the stream was removed.stream
argument is nil
or the stream has already been removed from this feature then calls to this method do nothing and return NO
.- (void) sendWithTopicPath: | (NSString *) | topicPath | |
content: | (PTDiffusionContent *) | content | |
completionHandler: | (NSError *_Nullable error) | __deprecated | |
Send an arbitrary message to the server on a particular topic path using default send options.
The path does not need to correspond to an existing topic; however the use of /
as a hierarchical delimiter allows for other sessions to listen to messages from specific paths.
topicPath | The topic path on which to send the message. |
content | The content of the message. |
completionHandler | Block to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | Raised if any supplied arguments are nil . |
- (void) sendWithTopicPath: | (NSString *) | topicPath | |
content: | (PTDiffusionContent *) | content | |
options: | (PTDiffusionSendOptions *) | options | |
completionHandler: | (NSError *_Nullable error) | __deprecated | |
Send an arbitrary message to the server on a particular topic path.
The path does not need to correspond to an existing topic; however the use of /
as a hierarchical delimiter allows for other sessions to listen to messages from specific paths.
topicPath | The topic path on which to send the message. |
content | The content of the message. |
options | The send options to use. |
completionHandler | Block to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | Raised if any supplied arguments are nil . |
- (void) sendWithTopicPath: | (NSString *) | topicPath | |
value: | (PTDiffusionBytes *) | value | |
completionHandler: | (NSError *_Nullable error) | completionHandler | |
Send an arbitrary message to the server on a particular topic path using default send options.
The path does not need to correspond to an existing topic; however the use of /
as a hierarchical delimiter allows for other sessions to listen to messages from specific paths.
topicPath | The topic path on which to send the message. |
value | The content of the message. |
completionHandler | Block to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | Raised if any supplied arguments are nil . |
- (void) sendWithTopicPath: | (NSString *) | topicPath | |
value: | (PTDiffusionBytes *) | value | |
options: | (PTDiffusionSendOptions *) | options | |
completionHandler: | (NSError *_Nullable error) | completionHandler | |
Send an arbitrary message to the server on a particular topic path.
The path does not need to correspond to an existing topic; however the use of /
as a hierarchical delimiter allows for other sessions to listen to messages from specific paths.
topicPath | The topic path on which to send the message. |
value | The content of the message. |
options | The send options to use. |
completionHandler | Block to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | Raised if any supplied arguments are nil . |