HYPMessage
@interface HYPMessage
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.
-
The data holds the content that was sent or received with a given message.
Declaration
Objective-C
@property (readonly, atomic) int *data;
Swift
var data: UnsafeMutablePointer<Int32>! { get }
-
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) int identifier;
Swift
var identifier: Int32 { get }
-
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: HYPMessageInfo! { get }
-
Initializes a message object with the given parameters.
Declaration
Objective-C
- (instancetype)initWithInfo:(HYPMessageInfo *)info data:(id)data;
Swift
init!(info: HYPMessageInfo!, data: Any!)
Parameters
info
Message metadata.
data
The data to associate the message with.
-
This method returns
YES
if the two instances (self and message) have the same message identifier. It returnsNO
otherwise.Declaration
Objective-C
- (id)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.