ARTChannelProtocol
Objective-C
@protocol ARTChannelProtocol
Swift
protocol ARTChannelProtocol
The protocol upon which ARTRestChannelProtocol and ARTRealtimeChannelProtocol are based.
-
The channel name.
Declaration
Objective-C
@property (readonly) NSString *_Nonnull name;Swift
var name: String { get } -
Publishes a single message to the channel with the given event name and payload. When publish is called with this client library, it won’t attempt to implicitly attach to the channel, so long as transient publishing is available in the library. Otherwise, the client will implicitly attach.
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data;Swift
func publish(_ name: String?, data: Any?)Parameters
nameThe name of the message.
dataThe payload of the message.
-
Publishes a single message to the channel with the given event name and payload. A callback may optionally be passed in to this call to be notified of success or failure of the operation. When publish is called with this client library, it won’t attempt to implicitly attach to the channel, so long as transient publishing is available in the library. Otherwise, the client will implicitly attach.
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data callback:(nullable ARTCallback)callback;Swift
func publish(_ name: String?, data: Any?, callback: ARTCallback? = nil)Parameters
nameThe name of the message.
dataThe payload of the message.
callbackA success or failure callback function.
-
Publishes an array of messages to the channel. A callback may optionally be passed in to this call to be notified of success or failure of the operation.
Declaration
Objective-C
- (void)publish:(nonnull NSArray<ARTMessage *> *)messages callback:(nullable ARTCallback)callback;Swift
func publish(_ messages: [ARTMessage], callback: ARTCallback? = nil)Parameters
messagesAn array of
ARTMessageobjects.callbackA success or failure callback function.
-
Updates a previously published message on the channel with operation metadata and params.
Declaration
Objective-C
- (void)updateMessage:(nonnull ARTMessage *)message operation:(nullable ARTMessageOperation *)operation params:(nullable NSDictionary<NSString *, ARTStringifiable *> *) params callback:(nullable ARTCallback)callback;Swift
func update(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String : ARTStringifiable]?, callback: ARTCallback? = nil)Parameters
messageThe message to update (must contain a populated serial field).
operationOptional operation metadata for the update.
paramsOptional publish params.
callbackA success or failure callback function.
-
Deletes a previously published message on the channel with operation metadata and params.
Declaration
Objective-C
- (void)deleteMessage:(nonnull ARTMessage *)message operation:(nullable ARTMessageOperation *)operation params:(nullable NSDictionary<NSString *, ARTStringifiable *> *) params callback:(nullable ARTCallback)callback;Swift
func delete(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String : ARTStringifiable]?, callback: ARTCallback? = nil)Parameters
messageThe message to delete (must contain a populated serial field).
operationOptional operation metadata for the delete.
paramsOptional publish params.
callbackA success or failure callback function.
-
Retrieves a single message by its serial identifier.
Declaration
Objective-C
- (void)getMessageWithSerial:(nonnull NSString *)serial callback:(nonnull ARTMessageErrorCallback)callback;Swift
func getMessageWithSerial(_ serial: String, callback: @escaping ARTMessageErrorCallback)Parameters
serialThe serial of the message to retrieve.
callbackA callback that receives the message or an error.
-
Retrieves the version history of a message by its serial identifier.
Declaration
Objective-C
- (void)getMessageVersionsWithSerial:(nonnull NSString *)serial callback: (nonnull ARTPaginatedMessagesCallback)callback;Swift
func getMessageVersions(withSerial serial: String, callback: @escaping ARTPaginatedMessagesCallback)Parameters
serialThe serial of the message whose versions to retrieve.
callbackA callback for retrieving a paginated result of message versions.