HYPMessage
@interface HYPMessage : NSObject
@abstract Represents a message sent over the network.
@discussion Messages are abstract entities that help keeping track of data as it is sent over the network, by holding a unique identifier. The identifier is actually held by the underlying HYPMessageInfo instance (-info), but the HYPMessage class provides dynamic access to that attribute. This is mostly motivated by the fact that Hype does not keep messages for memory purposes. As such, it’s up to the developer to hold or discard the data as needed. Instead, HYPMessageInfo instances are used to keep track of the state of any given HYPMessage.
-
@abstract Message data.
@discussion The data holds the content that was sent or received with a given message.
Declaration
Objective-C
@property (readonly, atomic) NSData *data;
Swift
var data: UnsafeMutablePointer
-
@abstract The message’s identifier.
@discussion This property uses dynamic storage to access the identifier from the underlying HYPMessageInfo instance. It returns an identifier that has been uniquely assigned to this message.
Declaration
Objective-C
@property (readonly, atomic) NSUInteger identifier;
Swift
var identifier: Int32 { get }
-
@abstract Message metadata.
@discussion Instances of HYPMessageInfo hold message metadata. Currently, this only includes the message’s identifier, but future releases will use this for other purposes.
Declaration
Objective-C
@property (readonly, atomic) HYPMessageInfo *info;
Swift
var info: UnsafeMutablePointer
-
@abstract Initializer.
@discussion Initializes a message object with the given parameters.
Declaration
Objective-C
- (instancetype)initWithInfo:(HYPMessageInfo *)info data:(NSData *)data;
Swift
init!(info: Any!, data: Any!)
Parameters
info
Message metadata.
data
The data to associate the message with.
-
@abstract Compares two HYPMessage instances.
@discussion This method returns YES if the two instances (self and message) have the same message identifier. It returns NO otherwise.
Declaration
Objective-C
- (BOOL)isEqualToMessage:(HYPMessage *)message;
Swift
func isEqual(to message: HYPMessage!) -> Any!
Parameters
message
The HYPMessage instance to compare.
Return Value
Whether the two messages have equal identifier.