Skip to main content

Room

Room

Represents a room on the server. Manages the connection to the server and the datastore.

Events

connectionStateChanged

event ConnectionStateChanged connectionStateChanged

rpcMessageReceived

event RPCMessageReceived rpcMessageReceived

onWillWrite

event RoomEventHandler onWillWrite

onWillRead

event RoomEventHandler onWillRead

onDidWrite

event RoomEventHandler onDidWrite

onDidRead

event RoomEventHandler onDidRead

Properties

name

string name { get; }

region

RegionMetadata? region { get; }

When Room moves to a ConnectingToRoom state, this will be filled in with metadata about the region being connected to, including an IP address that can be used to ping the region.

clientID

int clientID { get; }

time

double time { get; }

The server time on this frame in unix epoch time format. This value can be used to drive animations and is backed by a monotonic clock with sub-millisecond precision. This value has latency from the server removed.

ping

float ping { get; }

The local client's last known ping with the server in milliseconds.

connectionState

ConnectionState connectionState { get; }

The connection state of the room.

connecting

bool connecting { get; }

True if the room is connecting to the server.

connected

bool connected { get; }

True if the room is connected to the server.

disconnected

bool disconnected { get; }

True if the room is disconnected or in an error state.

offlineMode

bool offlineMode { get; }

True if the client was started in offline mode with no networking capabilities.

datastoreFrameDuration

double datastoreFrameDuration { get; set; }

debugLogging

bool debugLogging { get; set; }

realtime

Component realtime { get; set; }

datastore

Datastore datastore { get; }

Methods

Dispose

void Dispose()

Connect

void Connect(string roomName, string appKey, string matcherURL = null, RealtimeModel roomModel = null)

Connect

void Connect(string roomName, ConnectOptions connectOptions)

Disconnect

void Disconnect()

Tick

void Tick(double deltaTime)

SendRPCMessage

bool SendRPCMessage(byte[] data, bool reliable)

SendRPCMessage

bool SendRPCMessage(byte[] data, int dataLength, bool reliable)

CreateAudioInputStream

AudioInputStream CreateAudioInputStream(bool voice, int sampleRate, int channels)

GetAudioOutputStream

AudioOutputStream GetAudioOutputStream(int clientID, int streamID)