React Sample Workflow#
This sample workflow documents the end-to-end process for the CloudXR.js React sample: an advanced sample using React Three Fiber, React Three XR, and React Three UIKit to create immersive XR streaming experiences with rich 3D user interfaces.
Prerequisites#
CloudXR Runtime server is running with
auto-webrtcdevice profile.Node.js v20 or later (for local development) or Docker (for containerized setup).
CloudXR.js package tarball from NGC (initial distribution model). This is not the same as the tarball included in the host server build. Download it from: https://catalog.ngc.nvidia.com/orgs/nvidia/resources/cloudxr-js/files.
Option A: Docker (Quick Start)#
Build and run the sample in a container with no local toolchain required:
# Build the Docker image
docker build -t cloudxr-react-sample --build-arg EXAMPLE_NAME=react .
# Run the container
docker run -d --name cloudxr-react-sample -p 8080:80 -p 8443:443 cloudxr-react-sample
Open http://localhost:8080 (HTTP) or https://localhost:8443 (HTTPS) in your browser.
Note
When using HTTPS, accept the self-signed certificate warning in your browser.
To stop and remove the container:
docker stop cloudxr-react-sample && docker rm cloudxr-react-sample
Option B: Local Development#
Clone the samples repository and navigate to the sample directory:
git clone https://github.com/NVIDIA/cloudxr-js-samples.git cd cloudxr-js-samples/react
Refer to the requirements above, then install CloudXR.js from the downloaded tarball:
npm install </path/to/nvidia-cloudxr-<version>.tgz>
Install the remaining dependencies:
npm installBuild the sample:
npm run build
Start the web server:
HTTP (local development):
npm run dev-server
HTTPS (device testing or production-like):
npm run dev-server:https
Basic Usage#
Configure Connection: Enter your CloudXR server IP address, set the port (default:
49100), and select AR or VR immersive mode.Adjust Settings (optional): Configure per-eye resolution (
perEyeWidthmust be a multiple of 16 andperEyeHeightmust be a multiple of 64), target frame rate, streaming bitrate, and XR reference space.Start Streaming: Click CONNECT to initiate the XR session and grant XR permissions when prompted.
Tip
For the fastest way to get a server running, try the LÖVR sample: a lightweight VR framework ideal for testing your CloudXR.js client setup. For setup commands, refer to Quick Start Guide and End-to-End Example.
Runtime Configuration#
Before connecting, configure:
Server IP or host and signaling port
Connection mode (direct or proxy)
Rendering and stream settings for target device or network
Refer to Session API and Performance Guide for tuning guidance.
Validation Flow#
Validate from desktop browser first (IWER automatically loads for WebXR emulation).
Validate from headset after browser or device setup in Client Setup Guide.
For HTTPS mode, configure WSS proxy in WebSocket Proxy Setup.
Troubleshooting#
Connectivity and error-code diagnostics: Troubleshooting
Proxy and certificate issues: WebSocket Proxy Setup
Networking, firewall, and NAT: Network Setup