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

    name

    The name of the message.

    data

    The 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

    name

    The name of the message.

    data

    The payload of the message.

    callback

    A 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

    messages

    An array of ARTMessage objects.

    callback

    A 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

    message

    The message to update (must contain a populated serial field).

    operation

    Optional operation metadata for the update.

    params

    Optional publish params.

    callback

    A 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

    message

    The message to delete (must contain a populated serial field).

    operation

    Optional operation metadata for the delete.

    params

    Optional publish params.

    callback

    A 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

    serial

    The serial of the message to retrieve.

    callback

    A 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

    serial

    The serial of the message whose versions to retrieve.

    callback

    A callback for retrieving a paginated result of message versions.