Class DataSyncMessage
- Namespace
- SteamNetworkLib.Models
- Assembly
- SteamNetworkLib.dll
Represents a data synchronization message for sharing key-value data between players. Used for synchronizing game state, configuration data, or any structured information across the lobby.
public class DataSyncMessage : P2PMessage
- Inheritance
-
DataSyncMessage
- Inherited Members
Remarks
For simple, small data synchronization (typically under 1KB), consider using lobby data or member data instead:
- Use SteamLobbyData for lobby-wide data that all players need to see
- Use SteamMemberData for player-specific data that should be visible to all players
Constructors
DataSyncMessage()
public DataSyncMessage()
Properties
DataType
Gets or sets the data type identifier that describes the format of the value. Common values include "string", "json", "xml", "binary", etc.
public string DataType { get; set; }
Property Value
Key
Gets or sets the data key identifier. This key is used to identify what type of data is being synchronized.
public string Key { get; set; }
Property Value
MessageType
Gets the message type identifier for data sync messages.
public override string MessageType { get; }
Property Value
Value
Gets or sets the data value to be synchronized. Can contain any string data including JSON, XML, or plain text.
public string Value { get; set; }
Property Value
Methods
Deserialize(byte[])
Deserializes the data sync message from a byte array received over the network.
public override void Deserialize(byte[] data)
Parameters
data
byte[]The byte array containing the serialized message data.
Serialize()
Serializes the data sync message to a byte array for network transmission.
public override byte[] Serialize()
Returns
- byte[]
A byte array containing the serialized message data in JSON format.