Quick start
Build the server, give it a four-line config, and talk to it with curl. About ten minutes, most of it compiling.
You need
| Tool | Version | Used for |
|---|---|---|
| Rust | 1.91 or newer (edition 2024) | building the server |
| A C compiler | Apple clang, gcc or clang | the Opus and Lua bindings, which ADR-0007 and ADR-0008 allow to compile C |
| Node.js | 20 or newer | the Bench test console and these docs, not the server |
| Chrome | any recent | the headless end-to-end run, optional |
| Docker | any | the C oracle for parity captures, optional |
The C oracle (the original server at commit bc0de3b3) is only needed for parity work. You can run everything on this page without it.
1. Build
git clone https://github.com/januscaler/janus-server-rust.git
cd janus-server-rust
cargo build -p janus --features "plugin-echotest plugin-videoroom plugin-videocall plugin-streaming plugin-recordplay plugin-textroom plugin-audiobridge plugin-nosip plugin-sip"The binary is target/debug/janus. A plain cargo build -p janus builds only EchoTest and RecordPlay, because each plugin is a Cargo feature (the C build's --enable-* flags). See Build and run for the feature list and the release build.
2. Write a config
The server reads its configuration from a folder, one .jcfg file per component. Make the smallest useful one:
mkdir -p conf
cat > conf/janus.jcfg <<'CFG'
general: {
admin_secret = "janusoverlord"
}
CFG
cat > conf/janus.transport.http.jcfg <<'CFG'
general: {
http = true
port = 8088
}
admin: {
admin_http = true
admin_port = 7088
}
cors: {
allow_origin = "*"
}
CFG
cat > conf/janus.transport.websockets.jcfg <<'CFG'
general: {
ws = true
ws_port = 8188
}
CFG
cat > conf/janus.plugin.videoroom.jcfg <<'CFG'
room-1234: {
description = "Demo Room"
secret = "adminpwd"
publishers = 6
}
CFGThe Admin API is off by default, so admin_http = true turns it on. cors.allow_origin lets a browser app on another port, such as the Bench, call the server. Every key is in the config reference.
3. Start the server
target/debug/janus --configs-folder=$PWD/confIt prints the banner, the config it read, the plugins it registered and the ports it opened, and stays in the foreground. Look for these lines:
HTTP webserver started (port 8088, /janus path listener)...
Admin/monitor HTTP webserver started (port 7088, /admin path listener)...
WebSockets server started (port 8188)...A minimal config also works
With no janus.jcfg at all the server logs an error about the missing file, goes on with defaults and command-line options, and still opens the transports that have their own file. Verified by starting it with only janus.transport.http.jcfg.
4. Say hello
Ask the server about itself:
curl -s http://127.0.0.1:8088/janus/infoCreate a session, attach the VideoRoom plugin, and list the rooms. Replace the two ids with the ones the server returns:
curl -s -X POST http://127.0.0.1:8088/janus -d '{"janus":"create","transaction":"t1"}'
curl -s -X POST http://127.0.0.1:8088/janus/SESSION_ID -d '{"janus":"attach","plugin":"janus.plugin.videoroom","transaction":"t2"}'
curl -s -X POST http://127.0.0.1:8088/janus/SESSION_ID/HANDLE_ID -d '{"janus":"message","transaction":"t3","body":{"request":"list"}}'The last reply lists room 1234. The same exchange, recorded from the binary, is in the Janus API walkthrough.
Ask the Admin API what is connected:
curl -s -X POST http://127.0.0.1:7088/admin -d '{"janus":"list_sessions","transaction":"a1","admin_secret":"janusoverlord"}'5. Try real media
Curl cannot negotiate WebRTC. Use the Janus Bench: a browser app that publishes a test tone and a test pattern to EchoTest, VideoRoom and the rest, and says pass or fail for each.
cd webapp
npm install
npm run devOpen the address Vite prints, press Run all checks, and read the results page to know what to expect.
Where next
- Every file and key: Configuration.
- What each plugin does and its requests: Plugins.
- Coming from the C server: what is the same and what is not.
- Working on the port itself: Test and verify and the parity harness.