Diffusion Apple API
6.2.7
Unified Client Library for iOS, tvOS and OS X / macOS
|
The Messaging Control feature provides a client session with the ability to use messaging functionality to communicate directly with other client sessions.
The Messaging Control feature for a session can be obtained from the session's messagingControl
property.
For more detail, see: Messaging with the Apple client library.
Additional Inherited Members | |
Class Methods inherited from PTDiffusionFeature | |
(instancetype) | + NS_UNAVAILABLE |
Properties inherited from PTDiffusionFeature | |
PTDiffusionSession * | session |
- (void) addMessageHandlerForPath: | (NSString *) | path | |
withDelegate: | (id< PTDiffusionMessageDelegate >) | delegate | |
completionHandler: | (PTDiffusionTopicTreeRegistration *_Nullable) | registration | |
(NSError *_Nullable error) | completionHandler | ||
Register a message handler to handle messages received from other client sessions for a branch of the path hierarchy.
This is equivalent to calling addMessageHandler:forPath:sessionProperties:completionHandler: with an empty array for session properties.
delegate | Specifies the delegate for all messages sent on paths below and including the specified branch (unless overridden by a handler registered against a more specific branch). |
path | Identifies a branch in the path hierarchy. |
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 and the registration argument will not be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | If any arguments are nil . |
- (void) addMessageHandlerForPath: | (NSString *) | path | |
withDelegate: | (id< PTDiffusionMessageDelegate >) | delegate | |
sessionProperties: | (NSArray< NSString * > *) | sessionProperties | |
completionHandler: | (PTDiffusionTopicTreeRegistration *_Nullable) | registration | |
(NSError *_Nullable error) | completionHandler | ||
Register a message handler to handle messages received from other client sessions for a branch of the path hierarchy.
The handler will be invoked for paths below and including the specified path to which messages have been sent. This will only receive messages sent from a client (for example by one of the send methods in the PTDiffusionMessagingFeature) and not any updates to topics that are bound to the same paths.
Each control session can register a single handler for a branch. When the handler is no longer required, it can be closed using the close method (see PTDiffusionTopicTreeRegistration). To change the handler for a particular branch the previous handler must first be closed.
delegate | Specifies the delegate for all messages sent on paths below and including the specified branch (unless overridden by a handler registered against a more specific branch). |
path | Identifies a branch in the path hierarchy. |
sessionProperties | a list of keys of session properties that should be supplied with each message. See PTDiffusionSession for a full list of available fixed property keys. To request no properties supply an empty list. To request all fixed properties include [PTDiffusionSession allFixedProperties] as a key. In this case any other fixed property keys would be ignored. To request all user properties include [PTDiffusionSession allUserProperties] as a key. In this case any other user properties are ignored. |
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 and the registration argument will not be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | If any arguments are nil . |
- (void) addRequestHandler: | (PTDiffusionRequestHandler *) | handler | |
forPath: | (NSString *) | path | |
completionHandler: | (PTDiffusionTopicTreeRegistration *_Nullable) | registration | |
(NSError *_Nullable error) | completionHandler | ||
Register a request handler to handle messages received from other client sessions on a path.
This is equivalent to calling addRequestHandler:forPath:requestClass:responseClass:sessionProperties:completionHandler: with an empty array for session properties.
handler | Specifies the handler to be registered at the server. |
path | The request path. |
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 and the registration argument will not be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | If any argument is nil . |
- (void) addRequestHandler: | (PTDiffusionRequestHandler *) | handler | |
forPath: | (NSString *) | path | |
sessionProperties: | (NSArray< NSString * > *) | sessionProperties | |
completionHandler: | (PTDiffusionTopicTreeRegistration *_Nullable) | registration | |
(NSError *_Nullable error) | completionHandler | ||
Register a request handler to handle messages received from other client sessions on a path.
handler | Specifies the handler to be registered at the server. |
path | The request path. |
sessionProperties | a list of keys of session properties that should be supplied with each message. See PTDiffusionSession for a full list of available fixed property keys. To request no properties supply an empty list. To request all fixed properties include [PTDiffusionSession allFixedProperties] as a key. In this case any other fixed property keys would be ignored. To request all user properties include [PTDiffusionSession allUserProperties] as a key. In this case any other user properties are ignored. |
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 and the registration argument will not be nil . The completion handler will be called asynchronously on the main dispatch queue. |
NSInvalidArgumentException | If any argument is nil . |
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toFilter: | (NSString *) | filter | |
path: | (NSString *) | path | |
responseStream: | (PTDiffusionSessionResponseStream *) | responseStream | |
completionHandler: | (NSUInteger) | count | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to all sessions that satisfy a given session filter.
request | The request to send. |
filter | The session filter expression. |
path | The path to send the request to. |
responseStream | The stream that will handle the incoming responses. The delegate associated with this stream will be sent messages asynchronously on the main dispatch queue. |
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. Success indicates that the server has dispatched all the requests. |
nil
for the error
argument and zero for the count
argument if no client sessions matched the filter.NSInvalidArgumentException | Raised if any supplied arguments are nil . |
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
binaryCompletionHandler: | (PTDiffusionBinary *_Nullable) | binary | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to a session for which a binary response is expected.
request | The request to send. |
sessionId | The session to send the request to. |
path | The path to send the request to. |
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 . |
Provided by category PTDiffusionMessagingControlFeature(PTDiffusionBinary).
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
doubleFloatNumberCompletionHandler: | (NSNumber *_Nullable) | string | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to a session for which a double-precision floating point (Eight-byte IEEE 754) response is expected.
request | The request to send. |
sessionId | The session to send the request to. |
path | The path to send the request to. |
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 . |
Provided by category PTDiffusionMessagingControlFeature(PTDiffusionPrimitive).
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
int64NumberCompletionHandler: | (NSNumber *_Nullable) | string | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to a session for which a 64-bit integer response is expected.
request | The request to send. |
sessionId | The session to send the request to. |
path | The path to send the request to. |
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 . |
Provided by category PTDiffusionMessagingControlFeature(PTDiffusionPrimitive).
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
JSONCompletionHandler: | (PTDiffusionJSON *_Nullable) | json | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to a session for which a JSON response is expected.
request | The request to send. |
sessionId | The session to send the request to. |
path | The path to send the request to. |
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 . |
Provided by category PTDiffusionMessagingControlFeature(PTDiffusionJSON).
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
recordCompletionHandler: | (PTDiffusionRecordV2 *_Nullable) | record | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to a session for which a record response is expected.
request | The request to send. |
sessionId | The session to send the request to. |
path | The path to send the request to. |
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 . |
Provided by category PTDiffusionMessagingControlFeature(PTDiffusionRecordV2).
- (void) sendRequest: | (PTDiffusionRequest *) | request | |
toSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
stringCompletionHandler: | (NSString *_Nullable) | string | |
(NSError *_Nullable error) | completionHandler | ||
Send a request to a session for which a string response is expected.
request | The request to send. |
sessionId | The session to send the request to. |
path | The path to send the request to. |
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 . |
Provided by category PTDiffusionMessagingControlFeature(PTDiffusionPrimitive).
- (void) sendToFilter: | (NSString *) | filter | |
path: | (NSString *) | path | |
message: | (PTDiffusionBytes *) | message | |
completionHandler: | (NSUInteger) | count | |
(NSError *_Nullable error) | completionHandler | ||
Send a message to all sessions that satisfy a given session filter using a specific path.
This is equivalent to calling sendToFilter:path:message:options:completionHandler: with default options.
filter | The session filter expression. |
path | The message path that the message is to be associated with. |
message | The message to send. |
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 and the count argument indicates the number of clients that satisfied the filter and to which the message was sent. On failure the error argument passed to the block will not be nil and the count argument will be zero. The completion handler will be called asynchronously on the main dispatch queue. |
nil
for the error
argument and zero for the count
argument if no client sessions matched the filter.NSInvalidArgumentException | If any arguments are nil . |
- (void) sendToFilter: | (NSString *) | filter | |
path: | (NSString *) | path | |
message: | (PTDiffusionBytes *) | message | |
options: | (PTDiffusionSendOptions *) | options | |
completionHandler: | (NSUInteger) | count | |
(NSError *_Nullable error) | completionHandler | ||
Send a message to all sessions that satisfy a given session filter using a specific path.
See PTDiffusionSession for a full description of filter expressions.
filter | The session filter expression. |
path | The message path that the message is to be associated with. |
message | The message to send. |
options | Message options, including headers and priority. |
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 and the count argument indicates the number of clients that satisfied the filter and to which the message was sent. On failure the error argument passed to the block will not be nil and the count argument will be zero. The completion handler will be called asynchronously on the main dispatch queue. |
nil
for the error
argument and zero for the count
argument if no client sessions matched the filter.NSInvalidArgumentException | If any arguments are nil . |
- (void) sendToSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
message: | (PTDiffusionBytes *) | message | |
completionHandler: | (NSError *_Nullable error) | completionHandler | |
Send a message to a session using a specific path.
This is equivalent to calling sendToSessionId:path:message:options:completionHandler: with default options.
sessionId | Identifies the session to which the message will be sent. |
path | The message path that the message is to be associated with. |
message | The message to send. |
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 | If any arguments are nil . |
- (void) sendToSessionId: | (PTDiffusionSessionId *) | sessionId | |
path: | (NSString *) | path | |
message: | (PTDiffusionBytes *) | message | |
options: | (PTDiffusionSendOptions *) | options | |
completionHandler: | (NSError *_Nullable error) | completionHandler | |
Send a message to a session using a specific path.
sessionId | Identifies the session to which the message will be sent. |
path | The message path that the message is to be associated with. |
message | The message to send. |
options | Message options, including headers and priority. |
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 | If any arguments are nil . |