ARTMessage
Objective-C
@interface ARTMessage : ARTBaseMessage
Swift
class ARTMessage : ARTBaseMessage
Contains an individual message that is sent to, or received from, Ably.
-
The event name, if available
Declaration
Objective-C
@property (nonatomic, nullable) NSString *name;Swift
var name: String? { get set } -
The action type of the message, one of the
ARTMessageActionenum values.Declaration
Objective-C
@property (nonatomic) ARTMessageAction action;Swift
var action: ARTMessageAction { get set } -
This message’s unique serial (an identifier that will be the same in all future updates of this message).
Declaration
Objective-C
@property (nonatomic, nullable) NSString *serial;Swift
var serial: String? { get set } -
The version information for the message, containing serial, timestamp, and operation metadata.
Declaration
Objective-C
@property (nonatomic, nullable) ARTMessageVersion *version;Swift
var version: ARTMessageVersion? { get set } -
Contains annotations for the message, including summary data.
Declaration
Objective-C
@property (nonatomic, nullable) ARTMessageAnnotations *annotations;Swift
var annotations: ARTMessageAnnotations? { get set } -
Construct an
ARTMessageobject with an event name and payload.Declaration
Objective-C
- (nonnull instancetype)initWithName:(nullable NSString *)name data:(nonnull id)data;Swift
init(name: String?, data: Any)Parameters
nameThe event name.
dataThe message payload.
-
Construct an
ARTMessageobject with an event name, payload, and a unique client ID.Declaration
Objective-C
- (nonnull instancetype)initWithName:(nullable NSString *)name data:(nonnull id)data clientId:(nonnull NSString *)clientId;Swift
init(name: String?, data: Any, clientId: String)Parameters
nameThe event name.
dataThe message payload.
clientIdThe client ID of the publisher of this message.
-
A static factory method to create an
ARTMessageobject from a deserialized Message-like object encoded using Ably’s wire protocol.Declaration
Objective-C
+ (nullable instancetype)fromEncoded:(nonnull NSDictionary *)jsonObject channelOptions:(nonnull ARTChannelOptions *)options error:(NSError *_Nullable *_Nullable)error;Swift
class func fromEncoded(_ jsonObject: [AnyHashable : Any], channelOptions options: ARTChannelOptions) throws -> SelfParameters
jsonObjectA
Message-like deserialized object.optionsAn
ARTChannelOptionsobject. If you have an encrypted channel, use this to allow the library to decrypt the data.Return Value
An
ARTMessageobject. -
A static factory method to create an array of
ARTMessageobjects from an array of deserialized Message-like object encoded using Ably’s wire protocol.Declaration
Objective-C
+ (nullable NSArray<ARTMessage *> *) fromEncodedArray:(nonnull NSArray<NSDictionary *> *)jsonArray channelOptions:(nonnull ARTChannelOptions *)options error:(NSError *_Nullable *_Nullable)error;Swift
class func fromEncodedArray(_ jsonArray: [[AnyHashable : Any]], channelOptions options: ARTChannelOptions) throws -> [ARTMessage]Parameters
jsonArrayAn array of
Message-like deserialized objects.optionsAn
ARTChannelOptionsobject. If you have an encrypted channel, use this to allow the library to decrypt the data.Return Value
An array of
ARTMessageobjects.