.NET Client Reference
Class Message
Namespace: PlayerIOClient
Language: C# / .NET
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:
Usually, it's much easier to simply use the convenience methods:
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.
Properties
|
| public uint |
The number of data entries in the message, excluding the type.
|
| public string |
The type of the current message
|
Methods
|
| public void |
Add a long to the message payload
|
| public void |
Add a ulong to the message payload
|
| public void |
Add a uint to the message payload
|
| public void |
Add a string to the message payload
|
| public void |
Add a int to the message payload
|
| public void |
Add a bool to the message payload
|
| public void |
| Add |
(params object[] parameters) |
Add multiple pieces of data to the message in one go.
|
| public void |
Add a double to the message payload
|
| public void |
Add a byte[] to the message payload
|
| public void |
Add a float to the message payload
|
| public Message |
| Create |
(string type, params object[] parameters) |
Create a new Message
|
| public bool |
Gets the bool at the given index
|
| public Byte[] |
Gets the byte[] at the given index
|
| public Double |
Gets the double at the given index
|
| public Single |
Gets the float at the given index
|
| public int |
Gets the int at the given index
|
| public int |
Gets the int at the given index
|
| public Int64 |
Gets the long at the given index
|
| public string |
Gets the string at the given index
|
| public uint |
Gets the uint at the given index
|
| public UInt64 |
Gets the ulong at the given index
|
| public uint |
Gets the uint at the given index
|
| public UInt64 |
Gets the ulong at the given index
|
Count
The number of data entries in the message, excluding the type.
Return Value
Type
The type of the current message
Return Value
Add
Add a long to the message payload
Arguments
| Int64 |
value |
|
the value to add |
Add
Add a ulong to the message payload
Arguments
| UInt64 |
value |
|
the value to add |
Add
Add a uint to the message payload
Arguments
| uint |
value |
|
the value to add |
Add
Add a string to the message payload
Arguments
| string |
value |
|
the value to add |
Add
Add a int to the message payload
Arguments
| int |
value |
|
the value to add |
Add
Add a bool to the message payload
Arguments
| bool |
value |
|
the value to add |
Add
Add multiple pieces of data to the message in one go.
Arguments
| params object[] |
parameters |
|
The data to add to the message |
Example
Adding a string, a number and two boolean values to the message.
Add
Add a double to the message payload
Arguments
| Double |
value |
|
the value to add |
Add
Add a byte[] to the message payload
Arguments
| Byte[] |
value |
|
the value to add |
Add
Add a float to the message payload
Arguments
| Single |
value |
|
the value to add |
Create
Create a new Message
Arguments
| string |
type |
|
The type of message to create. |
| params object[] |
parameters |
|
A variable list of the data to add to the message. |
Return Value
GetBoolean
Gets the bool at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetByteArray
Gets the byte[] at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetDouble
Gets the double at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetFloat
Gets the float at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetInt
Gets the int at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetInteger
Gets the int at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetLong
Gets the long at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetString
Gets the string at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetUInt
Gets the uint at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetULong
Gets the ulong at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetUnsignedInteger
Gets the uint at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value
GetUnsignedLong
Gets the ulong at the given index
Arguments
| uint |
index |
|
The index to find the entry in |
Return Value