Objective-C Client Reference
Class PIOMessage
Language: Objective-C
Represents a message sent between client and server.
A message consists of a string type, and a payload of zero or more typed parameters.
For example here we create a simple message that we send to the server indicating that this player is ready:
You can also build up messages as you go, if you don't know the exact payload until runtime.
In this example, imagine the player has multiple pieces and we send in the list of moves this player wants to do in a single turn.
Methods | |||
---|---|---|---|
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (void) |
|
||
- (BOOL) |
|
||
- (BOOL) |
|
||
- (NSUInteger) |
|
||
- (NSData*) |
|
||
- (double) |
|
||
- (float) |
|
||
- (id) |
|
||
- (int32_t) |
|
||
- (int32_t) |
|
||
- (int64_t) |
|
||
+ (PIOMessage*) |
|
||
- (id) |
|
||
- (NSString*) |
|
||
- (NSString*) |
|
||
- (PIOMessageEntryType) |
|
||
- (uint32_t) |
|
||
- (uint64_t) |
|
addBool:
Add a boolean value to the end of the message
Arguments
BOOL | string |
addBoolean:
Add a boolean value to the end of the message
Arguments
BOOL | string |
addData:
Add an NSData object to the end of the message
Arguments
NSData* | string |
addDouble:
Add a floating point (64bit) value to the end of the message
Arguments
double | string |
addFloat:
Add a floating point (32bit) value to the end of the message
Arguments
float | string |
addInt:
Add an integer value to the end of the message
Arguments
int32_t | string |
addInteger:
Add an integer value to the end of the message
Arguments
int32_t | string |
addLong:
Add a long (64bit) value to the end of the message
Arguments
int64_t | string |
addString:
Add a string value to the end of the message
Arguments
NSString* | string |
addUInt:
Add an unsigned integer value to the end of the message
Arguments
uint32_t | string |
addUnsignedInteger:
Add an unsigned integer value to the end of the message
Arguments
uint32_t | string |
addUnsignedLong:
Add an unsigned long (64bit) value to the end of the message
Arguments
uint64_t | string |
boolAtIndex:
Get the boolean value at the given index
Arguments
NSUInteger | index |
Return Value
BOOL | |
booleanAtIndex:
Get the boolean value at the given index
Arguments
NSUInteger | index |
Return Value
BOOL | |
count
Get the number of objects in this Message.
Return Value
NSUInteger | |
dataAtIndex:
Get the NSData value at the given index
Arguments
NSUInteger | index |
Return Value
NSData* | |
doubleAtIndex:
Get the double value at the given index
Arguments
NSUInteger | index |
Return Value
double | |
floatAtIndex:
Get the float value at the given index
Arguments
NSUInteger | index |
Return Value
float | |
initWithType:
Initialize the message with the given type.
Arguments
NSString* | type |
Return Value
id | |
intAtIndex:
Get the integer value at the given index
Arguments
NSUInteger | index |
Return Value
int32_t | |
integerAtIndex:
Get the integer value at the given index
Arguments
NSUInteger | index |
Return Value
int32_t | |
longAtIndex:
Get the long value (64bit) at the given index
Arguments
NSUInteger | index |
Return Value
int64_t | |
messageWithType:
Create a new autoreleased message with the given type
Arguments
NSString* | type |
Return Value
PIOMessage* | |
objectAtIndex:
Gets the object at the given index
Arguments
NSUInteger | index |
Return Value
id | |
stringAtIndex:
Get the NSString value at the given index
Arguments
NSUInteger | index |
Return Value
NSString* | |
type
The type of the message.
Return Value
NSString* | |
typeAtIndex:
Gets the type of object at the given index
Arguments
NSUInteger | index |
Return Value
PIOMessageEntryType | |
unsignedIntegerAtIndex:
Get the unsigned integer value at the given index
Arguments
NSUInteger | index |
Return Value
uint32_t | |
unsignedLongAtIndex:
Get the unsigned long (64bit) value at the given index
Arguments
NSUInteger | index |
Return Value
uint64_t | |