V8 Javascript API

Directives

[Configuration]

Description

The following directives can be used inside the V8 user configuration block.

‎ commands directory 
Specifies a single directory that contains command modules.

Each file in the given directory here is loaded as a module at startup, and if it contains a command it is registered with RealityServer. Relative paths are resolved relative to the directory that contains realityserver.conf. This directive can be specified multiple times and is a required directive.

‎ include directory 
Specifies a single directory that contains generic modules.

These modules can be loaded by commands, or other modules, using require. Relative paths are resolved relative to the directory that contains realityserver.conf. This directive can be specified multiple times and is a required directive.

‎ isolate_pool_size size 
Specifies the number of V8 isolates to keep in the isolate pool.

An isolate is a V8 execution environment. Every command request that uses a V8 command needs an isolate to execute in. These isolates are stored in a pool to allow reuse and this specifies the maximum pool size. Larger pool sizes should be used if many concurrent command requests are expected. RealityServer will log messages when the pool size is exceeded, if this message appears often you should increase the pool size.

See Execution Environment for more details on isolates.

Defaults to 4.

‎ developer_mode on 
Use this directive to enable developer mode.

In developer mode the configured command and include directories are monitored, and if their contents change then all commands and modules are reloaded. This allows for rapid development of commands without having to restart RealityServer whenever a file is edited. Additionally, in developer mode when a command throws an unexpected error more detailed error data (file and line #, stack trace etc.) are returned to the client. In non-developer mode this information is only written to the log file.

Defaults to off.

‎ inspector 20000 
Use this directive to enable the debug inspector protocol on the given address.

Enabling this feature allows Chrome DevTools (or any debugger supporting the V8 Inspector Protocol) to connect to RealityServer and debug executing V8 commands. See Command Debugging for details.

Defaults to an empty string which disables the debug inspector.

‎ v8_option option=value 
Allows for setting of internal V8 tuning options.

EG:

‎# Limit V8 memory usage to 2048MB
v8_option max-old-space-size=2048
Note that these options are outside of the control of RealityServer, are not supported and are not reliably documented. A list of available options can be generated by setting:
‎v8_option help
and running RealityServer. A list of options will be written to the console then RealityServer will exit (so remove the option afterwards). Note that options do not need to provide the leading --

Example:

‎<user v8>
# core RealityServer commands and include
commands v8/commands
include v8/include
# additional commands for my application
commands myapp/commands
developer_mode off
isolate_pool_size 8
</user>