Table of Contents

Class EventMessage

Namespace
SteamNetworkLib.Models
Assembly
SteamNetworkLib.dll

Represents an event message for broadcasting system events, game events, and notifications between players. Supports advanced features like priority levels, targeting, acknowledgments, and expiration.

public class EventMessage : P2PMessage
Inheritance
EventMessage
Inherited Members

Constructors

EventMessage()

public EventMessage()

Properties

EventData

Gets or sets the event payload data as a JSON string. Contains the actual data or parameters associated with the event.

public string EventData { get; set; }

Property Value

string

EventId

Gets or sets the unique event identifier for tracking and acknowledgment purposes. Automatically generated if not specified.

public string EventId { get; set; }

Property Value

string

EventName

Gets or sets the specific event name or identifier. This should be a unique identifier for the specific event being triggered.

public string EventName { get; set; }

Property Value

string

EventType

Gets or sets the type or category of the event. Common values include "system", "game", "user", "notification", etc.

public string EventType { get; set; }

Property Value

string

ExpiresAt

Gets or sets when the event expires for time-sensitive events. Events past their expiration time should be ignored by recipients.

public DateTime? ExpiresAt { get; set; }

Property Value

DateTime?

MessageType

Gets the message type identifier for event messages.

public override string MessageType { get; }

Property Value

string

Priority

Gets or sets the priority level of the event. Values: 0 = low, 1 = normal, 2 = high, 3 = critical. Higher priority events should be processed first.

public int Priority { get; set; }

Property Value

int

RequiresAck

Gets or sets a value indicating whether the event requires acknowledgment from recipients. When true, recipients should send back an acknowledgment message.

public bool RequiresAck { get; set; }

Property Value

bool

ShouldPersist

Gets or sets a value indicating whether this event should be persisted or logged. Useful for important events that need to be recorded for later analysis.

public bool ShouldPersist { get; set; }

Property Value

bool

Tags

Gets or sets additional tags for event categorization and filtering. Can be used to implement custom event filtering logic.

public string Tags { get; set; }

Property Value

string

TargetAudience

Gets or sets the target audience for the event. Common values include "all", "friends", "specific_players", "host_only", etc.

public string TargetAudience { get; set; }

Property Value

string

TargetPlayerIds

Gets or sets a comma-separated list of target player Steam IDs. Only used when TargetAudience is set to "specific_players".

public string TargetPlayerIds { get; set; }

Property Value

string

Methods

Deserialize(byte[])

Deserializes the event 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 event 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.