ARTChannel
Objective-C
@interface ARTChannel : NSObject
Swift
class ARTChannel : NSObject, @unchecked Sendable
The base class for ARTRestChannel and ARTRealtimeChannel.
Ably platform service organizes the message traffic within applications into named channels. Channels are the medium through which messages are distributed; clients attach to channels to subscribe to messages, and every message published to a unique channel is broadcast by Ably to all subscribers.
See
SeeARTChannelProtocol for details.
-
Undocumented
Declaration
Objective-C
@property (readonly) NSString *nameSwift
var name: String { get } -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data;Swift
func publish(_ name: String?, data: Any?) -
Undocumented
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) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data resultCallback:(nullable ARTPublishResultCallback)resultCallback;Swift
func publish(_ name: String?, data: Any?, resultCallback: ARTPublishResultCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data clientId:(NSString *)clientId;Swift
func publish(_ name: String?, data: Any?, clientId: String) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data clientId:(NSString *)clientId callback:(nullable ARTCallback)callback;Swift
func publish(_ name: String?, data: Any?, clientId: String, callback: ARTCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data extras:(nullable id<ARTJsonCompatible>)extras;Swift
func publish(_ name: String?, data: Any?, extras: (any ARTJsonCompatible)?) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data extras:(nullable id<ARTJsonCompatible>)extras callback:(nullable ARTCallback)callback;Swift
func publish(_ name: String?, data: Any?, extras: (any ARTJsonCompatible)?, callback: ARTCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data clientId:(NSString *)clientId extras:(nullable id<ARTJsonCompatible>)extras;Swift
func publish(_ name: String?, data: Any?, clientId: String, extras: (any ARTJsonCompatible)?) -
Undocumented
Declaration
Objective-C
- (void)publish:(nullable NSString *)name data:(nullable id)data clientId:(NSString *)clientId extras:(nullable id<ARTJsonCompatible>)extras callback:(nullable ARTCallback)callback;Swift
func publish(_ name: String?, data: Any?, clientId: String, extras: (any ARTJsonCompatible)?, callback: ARTCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)publish:(NSArray<ARTMessage *> *)messages;Swift
func publish(_ messages: [ARTMessage]) -
Undocumented
Declaration
Objective-C
- (void)publish:(NSArray<ARTMessage *> *)messages callback:(nullable ARTCallback)callback;Swift
func publish(_ messages: [ARTMessage], callback: ARTCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)publish:(NSArray<ARTMessage *> *)messages resultCallback:(nullable ARTPublishResultCallback)resultCallback;Swift
func publish(_ messages: [ARTMessage], resultCallback: ARTPublishResultCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)updateMessage:(ARTMessage *)message operation:(nullable ARTMessageOperation *)operation params:(nullable NSDictionary<NSString *, ARTStringifiable *> *)params wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents callback:(nullable ARTEditResultCallback)callback;Swift
func update(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String : ARTStringifiable]?, wrapperSDKAgents: [String : String]?, callback: ARTEditResultCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)deleteMessage:(ARTMessage *)message operation:(nullable ARTMessageOperation *)operation params:(nullable NSDictionary<NSString *, ARTStringifiable *> *)params wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents callback:(nullable ARTEditResultCallback)callback;Swift
func delete(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String : ARTStringifiable]?, wrapperSDKAgents: [String : String]?, callback: ARTEditResultCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)appendMessage:(ARTMessage *)message operation:(nullable ARTMessageOperation *)operation params:(nullable NSDictionary<NSString *, ARTStringifiable *> *)params wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents callback:(nullable ARTEditResultCallback)callback;Swift
func append(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String : ARTStringifiable]?, wrapperSDKAgents: [String : String]?, callback: ARTEditResultCallback? = nil) -
Undocumented
Declaration
Objective-C
- (void)getMessageWithSerial:(NSString *)serial wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents callback:(ARTMessageErrorCallback)callback;Swift
func getMessageWithSerial(_ serial: String, wrapperSDKAgents: [String : String]?, callback: @escaping ARTMessageErrorCallback) -
Undocumented
Declaration
Objective-C
- (void)getMessageVersionsWithSerial:(NSString *)serial wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents callback:(ARTPaginatedMessagesCallback)callback;Swift
func getMessageVersions(withSerial serial: String, wrapperSDKAgents: [String : String]?, callback: @escaping ARTPaginatedMessagesCallback) -
Undocumented
Declaration
Objective-C
- (void)historyWithWrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents completion:(ARTPaginatedMessagesCallback)callback;Swift
func history(withWrapperSDKAgents wrapperSDKAgents: [String : String]?) async -> (ARTPaginatedResult<ARTMessage>?, ARTErrorInfo?) -
Undocumented
Declaration
Objective-C
- (instancetype)initWithName:(NSString *)name andOptions:(ARTChannelOptions *)options rest:(ARTRestInternal *)rest logger:(ARTInternalLog *)logger;Swift
init(name: String, andOptions options: ARTChannelOptions, rest: ARTRestInternal, logger: InternalLog) -
Undocumented
Declaration
Objective-C
@property (readonly, nullable) ARTChannelOptions *optionsSwift
var options: ARTChannelOptions? { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) ARTDataEncoder *dataEncoderSwift
var dataEncoder: ARTDataEncoder { get } -
Exposed so that
ARTPluginAPIcan allow plugins to log via this channel.Declaration
Objective-C
@property (nonatomic, readonly) ARTInternalLog *_Nonnull logger;Swift
var logger: InternalLog { get } -
Internal method for publishing message on the channel.
@discussion Contract - Work already performed on the messages before calling this method:
- Messages have been created from raw parameters (name, data, clientId, extras)
- Data encoding has been applied via
encodeMessageIfNeeded:error:(this applies cipher encryption if the channel has cipher params configured) - Message size validation has been performed via
exceedMaxSize: - Encoding errors have been handled and will not reach this method
@discussion Contract - Work NOT yet performed (subclass responsibility):
- clientId validation (if required by the transport)
- Channel state checks (e.g., for realtime channels)
- Protocol message creation (for realtime) or REST request construction
- Actual transmission to the server
Subclasses (ARTRealtimeChannelInternal, ARTRestChannelInternal) override this method to implement their specific transport logic.
Declaration
Objective-C
- (void)internalPostMessages:(nonnull id)data callback:(nullable ARTPublishResultCallback)callback;Swift
func internalPostMessages(_ data: Any, callback: ARTPublishResultCallback? = nil)Parameters
dataCan be either:
- A single
ARTMessageobject - An
NSArrayofARTMessageobjects
callbackCallback invoked with the result of the operation (success with ARTPublishResult or error).
-
Internal method for sending a mutation request (update, append, delete) for a message.
@discussion Contract - Work already performed on the messages before calling this method:
- Data encoding has been applied per RSL4 via
encodeMessageIfNeeded:error:(this applies cipher encryption if the channel has cipher params configured) - Encoding errors have been handled and will not reach this method
@discussion Subclasses (ARTRealtimeChannelInternal, ARTRestChannelInternal) override this method to implement their specific transport logic for message mutations.
Declaration
Objective-C
- (void)internalSendEditRequestForMessage:(nonnull ARTMessage *)message params:(nullable NSDictionary< NSString *, ARTStringifiable *> *) params wrapperSDKAgents: (nullable NSStringDictionary *)wrapperSDKAgents callback: (nullable ARTEditResultCallback)callback;Swift
func internalSendEditRequest(for message: ARTMessage, params: [String : ARTStringifiable]?, wrapperSDKAgents: [String : String]?, callback: ARTEditResultCallback? = nil)Parameters
messageThe message to mutate (with action, version, etc. already set).
paramsOptional query parameters for the request.
wrapperSDKAgentsOptional wrapper SDK agents for the request.
callbackCallback invoked with the result of the operation (success or error).
- Data encoding has been applied per RSL4 via
-
Undocumented
Declaration
Objective-C
- (BOOL)exceedMaxSize:(NSArray<ARTBaseMessage *> *)messages;Swift
func exceedMaxSize(_ messages: [ARTBaseMessage]) -> Bool -
Undocumented
Declaration
Objective-C
- (nullable ARTChannelOptions *)options_nosync;Swift
func options_nosync() -> ARTChannelOptions? -
Undocumented
Declaration
Objective-C
- (void)setOptions_nosync:(ARTChannelOptions *_Nullable)options;Swift
func setOptions_nosync(_ options: ARTChannelOptions?)