Rooms Mode

Running a replication server in rooms mode is intended for short-term game sessions with generally fewer players. The primary advantage of using rooms is start-up time since the time it takes to create a room is very short compared to the time it takes to launch the replication server application. Rooms also support multiple simultaneous projects and schema whereas the replication server in world mode only supports one and must be restarted if the schema changes.

The creation, destruction, and status of rooms are accessed via the API.

Command Syntax

replication-server rooms --default-schema PATH [options]

In rooms mode there isn't a --schema option since the schema could be different per room. Instead, there is the --default-schema option which defines which schema is loaded for all rooms in addition to any schema specified when the room is created via the API.

Replication Server Rooms Mode Options

The following is an overview of options used when self hosting the replication server in rooms mode.

Basic Options

  • --help : prints out the options available for the mode. Usage: replication-server --help rooms

  • --eula : prints out the EULA

Basic Network Configuration

  • --udp-port : The port to listen to for UDP connections Default: 42001

  • --tcp-port: The port to listen to for TCP connections Default: 42001

Ping Service Configuration

  • --ping-port: The port for ping service to listen to. Service disabled if 0. Default: 0

  • --ping-rate-limit: Maximum pings per second for the ping service. Use 0 to disable rate limiting. Default: 1000

WebRTC Network Configuration

  • --signalling-port: The port for WebRTC signalling (offer/answer exchange, ICE candidates) Default: 42002 Note: coherence Cloud provides WebRTC signalling but when self hosting you have to provide your own signalling service and STUN / TURN.

  • --web-port: The port to listen to for WebRTC connections Default: 42003

  • --public-ip: The public IP for WebRTC connections via NAT Default: ""

Connection Configuration

  • --send-frequency: The packet send frequency in packets per second. Default: 20

  • --recv-frequency: The packet receive frequency in packets per second. This is the maximum rate at which the replication server will receive packets on a connection. If a connection sends packets at a higher rate it will be throttled and potentially disconnected. Default: 60

  • --disable-throttling: This option will disable packet receive rate throttling. Best used in client hosting with 3rd party relays that support DDOS protection. Default: throttling is enabled by default, this option has no parameters.

  • --disconnect-timeout: This sets the timeout in ms for disconnecting a client after not receiving any packets. Default: 5000 Notes: coherence connections maintain a keep-alive system that ensures that as long as a connection is possible that the connection is kept alive.

Environment Configuration

  • --default-schema: Specifies the default coherence schema used for serialization of entities, components, and commands shared by all rooms. Default: "" Notes: The string parameter is a CSV string of paths to .schema files. See schema explanation.

  • --env: Specifies the runtime environment. Default: "enduser" Values: (prod, staging, test, dev, enduser) Notes: The environment is included with metrics output and some logs. "prod" and "staging" are equivalent with respect to security. In development, the "dev" and "test" environment options remove some authentication restrictions as does "enduser" so they should not be used in a public production setting. "enduser" should only be used when client hosting. When developing, use "dev" as "test" is primarily for coherence internal testing.

  • --secret: The secret used for API request and client authentication. Default: "local-development" Notes: The default should be used for local development only. For API requests, the request bearer authentication must match the secret. See API reference for more info. See Authentication for more details on the use of --secret.

  • --room-size-limit: The hard limit of max clients in a room enforced at room creation. Default: 100

  • --cleanup-interval-sec: The interval in seconds between checks to clean up resources used by empty rooms. Default: 60 Notes: This prevents the resources used by rooms from lingering and being wasted. Generally, it is expected to close rooms that are unused after the interval time. If you require rooms to be open forever then set a very large number.

  • --auto-shutdown-timeout-ms: Specifies the number of milliseconds before a replication server with no connections automatically shuts down. Default: 0 Notes: 0 disables the auto-shutdown, otherwise it is a minimum of 10000ms.

  • --unlock-token: Internal to coherence, it is used to define the project and organization. OK to leave blank. Default: ""

  • --local-ip-override: Specifies the local IP for this instance of the replication server. Default: "127.0.0.1" Note: Used with WebRTC to associate a specific IP when auto-detection won't work. Also used in Windows to bypass localhost firewall restrictions when testing.

  • --version-override: Overrides the replication server version. Used for internal debugging only. Default: ""

Logging Configuration

  • --log-target: Enable logging context sensitive logs to the console and / or files. Default: "" Notes: The option parameter is a single LOG_TARGET or a CSV string of LOG_TARGETS. The syntax of a LOG_TARGET is: (console|file):(plain|colored|json):(trace|debug|info|warn|error):[filePath] It is also possible to have this parameter appear more than once each with a single LOG_TARGET instead of using CSV. Usage: --log-target "console:colored:info"

  • --log-stats-freq: The frequency, in seconds, that enabled stats are logged to the log targets. Default: 0 Notes: a frequency of 0 means the stats are not logged.

Monitoring Configuration

  • --use-p-prof: Enables Golang pprof Default: disabled by default, this option has no parameters, just include to enable.

  • --stats-port: The port for requesting statistics and profiling. See Monitoring. Default: 64000

  • --out-stats: The frequency, in seconds, of updates to profiling stats. See Monitoring. Default: 1

  • --api-port: The REST API port. See API Reference for more info. Default: 64001

  • --analytics-enabled: Enables coherence telemetry in "dev" and "enduser" environments. Default: disabled by default, this option has no parameters.

Note: experimental and deprecated options are not detailed here. For more info on those, please contact [email protected]

Last updated

Was this helpful?