Creates an instance of JanusAdmin.
which transport to use. i.e. WebSocket, HTTP or EventClientTranport
admin secret needed for some or all the APIs
Retrieve the admin secret used to initialize this instance
configure whether Janus should accept new incoming sessions or not; this can be particularly useful whenever, e.g., you want to stop accepting new sessions because you're draining this instance
const admin = new JanusAdmin(...);
const accept = await admin.accept_new_sessions(true);
...
add a valid token (only available if you enabled the Stored token based authentication mechanism)
token to add
which plugins to enable for that token
give a token access to a plugin (only available if you enabled the Stored token based authentication mechanism)
const admin = new JanusAdmin(...);
const allowed = await admin.allow_token('abcd',['janus.plugin.audiobridge']);
...
push a custom "external" event to notify via event handlers; this can be useful whenever info from a third-party application needs to be easily correlated to events originated by Janus, or to push information Janus doesn't have available (e.g., a script polling CPU usage regularly)
const admin = new JanusAdmin(...);
const response = await admin.custom_event("janus/events", { test: "valuetest" });
push a custom "external" string to print on the logs; this can be useful whenever info from a third-party application needs to be injected in the Janus logs for whatever reason. The log level can be chosen.
const admin = new JanusAdmin(...);
const response = await admin.custom_logline("test line", 4);
destroy a specific session; this behaves exactly as the destroy request does in the Janus API
const admin = new JanusAdmin(...);
const success = await admin.destroy_session();
...
detached a specific handle; this behaves exactly as the detach request does in the Janus API
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const handle_info = await admin.detach_handle(pluginHandle);
...
remove a token access from a plugin (only available if you enabled the Stored token based authentication mechanism)
const admin = new JanusAdmin(...);
const allowed = await admin.disallow_token('abcd',['janus.plugin.audiobridge']);
...
returns the current value for the settings that can be modified at runtime via the Admin API (see below)
const admin = new JanusAdmin(...);
const status = await admin.get_status();
...
list all the available info on a specific ICE handle
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const session : JanusSession = ...;
const handle_info = await admin.handle_info(session,pluginHandle,false);
...
hangups the PeerConnection associated with a specific handle; this behaves exactly as the hangup request does in the Janus API
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const handle_info = await admin.hangup_webrtc(pluginHandle);
...
get the generic on the Janus instance; this returns exactly the same information that a Janus API info request would return, and doesn't require any secret;
const admin = new JanusAdmin(...);
const server_info = await admin.info();
list all the ICE handles currently active in a Janus session (returns an array of handle identifiers)
const admin = new JanusAdmin(...);
const session : JanusSession = ...;
const handles = await admin.list_handles(session);
...
list all the sessions currently active in Janus (returns an array of session identifiers)
const admin = new JanusAdmin(...);
const sessions = await admin.list_sessions();
...
list the existing tokens (only available if you enabled the Stored token based authentication mechanism)
const admin = new JanusAdmin(...);
const tokens = await admin.list_tokens();
...
send a synchronous request to a plugin and return a response; implemented by most plugins to facilitate and streamline the management of plugin resources (e.g., creating rooms in a conference plugin)
const admin = new JanusAdmin(...);
const listReq: IListRequest = {
request: "list"
};
const response = await admin.message_plugin<IListResponse>("janus.plugin.videoroom", listReq);
a simple ping/pong mechanism for the Admin API, that returns a pong back that the client can use as a healthcheck or to measure the protocol round-trip time
const admin = new JanusAdmin(...);
const reply = await admin.ping();
console.log(reply); // pong
send a synchronous request to an event handler and return a response; implemented by most event handlers to dynamically configure some of their properties
const admin = new JanusAdmin(...);
const request: IMQTTEVHRequest = {
"request": "tweak",
"events": "all"
};
const response = await admin.query_eventhandler<IMQTTEVHRequest, any>("janus.eventhandler.mqttevh", request);
remove a token (only available if you enabled the Stored token based authentication mechanism)
const admin = new JanusAdmin(...);
const success = await admin.remove_token('abcd');
...
helper request to evaluate whether this Janus instance can resolve an address via DNS, and how long it takes
const admin = new JanusAdmin(...);
const response = await admin.resolve_address("www.google.com");
selectively enable/disable libnice debugging
const admin = new JanusAdmin(...);
const libnice_debug = await admin.set_libnice_debug(true);
...
selectively enable/disable a live debugging of the locks in Janus on the fly (useful if you're experiencing deadlocks and want to investigate them)
const admin = new JanusAdmin(...);
const locking_debug = await admin.set_locking_debug(true);
...
selectively enable/disable using colors in all log lines Janus writes on the console and/or to file
const admin = new JanusAdmin(...);
const colors = await admin.set_log_colors(true);
...
change the log level in Janus on the fly
0-7 where 0 is no log and 7 is debug log
selectively enable/disable adding a timestamp to all log lines Janus writes on the console and/or to file
const admin = new JanusAdmin(...);
const timestamps = await admin.set_log_timestamps(true);
...
change the value of the min NACK queue window
minimum NACK queue in ms
change the value of the no-media timer value on the fly
no-media timer in seconds
selectively enable/disable a live debugging of the reference counters in Janus on the fly (useful if you're experiencing memory leaks in the Janus structures and want to investigate them)
reference counters debug
const admin = new JanusAdmin(...);
const refcount_debug = await admin.set_refcount_debug(true);
...
change the session timeout value in Janus on the fly
session timeout in seconds
change the value of the slowlink-threshold property which is the number of lost packets that trigger slow link
number of packets to trigger slowlink
const admin = new JanusAdmin(...);
const slowlink_threshold = await admin.set_slowlink_threshold(4);
...
start dumping incoming and outgoing RTP/RTCP packets of a handle to a pcap file (e.g., for ex-post analysis via Wireshark) list all the available info on a specific ICE handle
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const started = await admin.start_pcap(pluginHandle,"/var/tmp","test.cap", 1024);
...
start dumping incoming and outgoing RTP/RTCP packets of a handle to a text2pcap file (e.g., for ex-post analysis via Wireshark)
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const started = await admin.start_text2pcap(pluginHandle,"/var/tmp","test.cap.txt", 1024);
...
stop the pcap dump
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const stopped = await admin.stop_pcap(pluginHandle);
...
stop the text2pcap dump
const admin = new JanusAdmin(...);
const pluginHandle : PluginHandle = ...;
const stopped = await admin.stop_text2pcap(pluginHandle);
...
helper request to evaluate whether this Janus instance can contact a STUN server, what is returned, and how long it takes.
const admin = new JanusAdmin(...);
const response = await admin.test_stun("stun.l.google.com", 19302);
Generated using TypeDoc
Janus Admin API
const adminTransport = ...; await adminTransport.waitForReady(); const admin = new JanusAdmin(...); ... await adminTransport.dispose();