JanusAdmin is a node.js http client, that implements the entire admin interface of the Janus WebRTC Gateway.
var JanusAdmin = require('janus-admin').JanusAdmin;
var admin = new JanusAdmin({
url: 'http://janus-admin:7088',
secret: '*****'
});
admin.listSessions().then((res)=>{
console.log(res.sessions)
}).catch((err)=>{
...
});
admin.listHandles(sessionId).then((res)=>{
console.log(res.handles)
}).catch((err)=>{
...
});
admin.handleInfo(sessionId, handleId).then((res)=>{
console.log(res.info)
}).catch((err)=>{
...
});
admin.setLogLevel([0...7]).then((res)=>{
console.log(res.level)
}).catch((err)=>{
...
});
admin.setLockingDebug([0,1]).then((res)=>{
console.log(res.debug)
}).catch((err)=>{
...
});
admin.addToken(token).then((res)=>{
console.log(res.plugins);
}).catch((err)=>{
...
});
admin.allowToken(token, plugins).then((res)=>{
console.log(res.plugins);
}).catch((err)=>{
...
});
admin.disallowToken(token, plugins).then((res)=>{
console.log(res.plugins);
}).catch((err)=>{
...
});
admin.listTokens().then((res)=>{
console.log(res.tokens);
}).catch((err)=>{
...
});
adminClient.removeToken(token).then((res)=>{
...
}).catch((err)=>{
...
});
adminClient.removeAllTokens().then((res)=>{
...
}).catch((err)=>{
...
});