@techteamer/janus-api
Version:
Janus WebRTC-Gateway API
41 lines (40 loc) • 1.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Janus_js_1 = __importDefault(require("./Janus.js"));
class JanusAdmin extends Janus_js_1.default {
/**
*
* @param config
* @param logger
*/
constructor(config, logger) {
super(config, logger);
this.config = config;
this.protocol = 'janus-admin-protocol';
this.sendCreate = false;
}
transaction(type, payload, replyType) {
const msg = Object.assign({}, payload, {
admin_secret: this.config.secret
});
return super.transaction(type, msg, replyType || 'success');
}
listSessions() {
return this.transaction('list_sessions').then(r => r.sessions);
}
listHandles(sessionId) {
return this.transaction('list_handles', {
session_id: sessionId
}).then(r => r.handles);
}
handleInfo(sessionId, handleId) {
return this.transaction('handle_info', {
session_id: sessionId,
handle_id: handleId
}).then(r => r.info);
}
}
exports.default = JanusAdmin;