New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

minijanus

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minijanus - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

48

bundle.js

@@ -19,4 +19,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Minijanus = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

JanusPluginHandle.prototype.attach = function(plugin) {
var payload = { janus: "attach", plugin: plugin, "force-bundle": true, "force-rtcp-mux": true };
return this.session.send(payload).then(resp => {
var payload = { plugin: plugin, "force-bundle": true, "force-rtcp-mux": true };
return this.session.send("attach", payload).then(resp => {
this.id = resp.data.id;

@@ -29,3 +29,3 @@ return resp;

JanusPluginHandle.prototype.detach = function() {
return this.send({ janus: "detach" });
return this.send("detach");
};

@@ -38,4 +38,4 @@

**/
JanusPluginHandle.prototype.send = function(signal) {
return this.session.send(Object.assign({ handle_id: this.id }, signal));
JanusPluginHandle.prototype.send = function(type, signal) {
return this.session.send(type, Object.assign({ handle_id: this.id }, signal));
};

@@ -45,3 +45,3 @@

JanusPluginHandle.prototype.sendMessage = function(body) {
return this.send({ janus: "message", body: body });
return this.send("message", { body: body });
};

@@ -51,3 +51,3 @@

JanusPluginHandle.prototype.sendJsep = function(jsep) {
return this.send({ janus: "message", body: {}, jsep: jsep });
return this.send("message", { body: {}, jsep: jsep });
};

@@ -57,3 +57,3 @@

JanusPluginHandle.prototype.sendTrickle = function(candidate) {
return this.send({ janus: "trickle", candidate: candidate });
return this.send("trickle", { candidate: candidate });
};

@@ -80,3 +80,3 @@

JanusSession.prototype.create = function() {
return this.send({ janus: "create" }).then(resp => {
return this.send("create").then(resp => {
this.id = resp.data.id;

@@ -89,3 +89,3 @@ return resp;

JanusSession.prototype.destroy = function() {
return this.send({ janus: "destroy" }).then(() => {
return this.send("destroy").then(() => {
this._killKeepalive();

@@ -115,13 +115,16 @@ });

}
if (signal.session_id != this.id) {
console.warn("Incorrect session ID received in Janus signalling message: was " + signal.session_id + ", expected " + this.id + ".");
}
if (signal.transaction != null) {
var handlers = this.txns[signal.transaction];
if (signal.janus === "ack") {
// this is an ack of an asynchronously-processed request, we should wait
var txn = this.txns[signal.transaction];
if (signal.janus === "ack" && txn.type == "message") {
// this is an ack of an asynchronously-processed plugin request, we should wait
// to resolve the promise until the actual response comes in
} else if (handlers != null) {
if (handlers.timeout != null) {
clearTimeout(handlers.timeout);
} else if (txn != null) {
if (txn.timeout != null) {
clearTimeout(txn.timeout);
}
delete this.txns[signal.transaction];
(this.isError(signal) ? handlers.reject : handlers.resolve)(signal);
(this.isError(signal) ? txn.reject : txn.resolve)(signal);
}

@@ -136,7 +139,8 @@ }

**/
JanusSession.prototype.send = function(signal) {
JanusSession.prototype.send = function(type, signal) {
var txid = (this.nextTxId++).toString();
signal = Object.assign({ janus: type, transaction: txid }, signal);
if (this.id != null) { // this.id is undefined in the special case when we're sending the session create message
signal = Object.assign({ session_id: this.id }, signal);
}
signal = Object.assign({ transaction: (this.nextTxId++).toString() }, signal);
if (module.exports.verbose) {

@@ -150,6 +154,6 @@ console.debug("Outgoing Janus signal: ", signal);

delete this.txns[signal.transaction];
reject(new Error("Signalling message timed out."));
reject(new Error("Signalling message with txid " + txid + " timed out."));
}, this.options.timeoutMs);
}
this.txns[signal.transaction] = { resolve: resolve, reject: reject, timeout: timeout };
this.txns[signal.transaction] = { resolve: resolve, reject: reject, timeout: timeout, type: type };
this.output(JSON.stringify(signal));

@@ -161,3 +165,3 @@ this._resetKeepalive();

JanusSession.prototype._keepalive = function() {
return this.send({ janus: "keepalive" });
return this.send("keepalive");
};

@@ -164,0 +168,0 @@

@@ -18,4 +18,4 @@ /** Whether to log information about incoming and outgoing Janus signals. **/

JanusPluginHandle.prototype.attach = function(plugin) {
var payload = { janus: "attach", plugin: plugin, "force-bundle": true, "force-rtcp-mux": true };
return this.session.send(payload).then(resp => {
var payload = { plugin: plugin, "force-bundle": true, "force-rtcp-mux": true };
return this.session.send("attach", payload).then(resp => {
this.id = resp.data.id;

@@ -28,3 +28,3 @@ return resp;

JanusPluginHandle.prototype.detach = function() {
return this.send({ janus: "detach" });
return this.send("detach");
};

@@ -37,4 +37,4 @@

**/
JanusPluginHandle.prototype.send = function(signal) {
return this.session.send(Object.assign({ handle_id: this.id }, signal));
JanusPluginHandle.prototype.send = function(type, signal) {
return this.session.send(type, Object.assign({ handle_id: this.id }, signal));
};

@@ -44,3 +44,3 @@

JanusPluginHandle.prototype.sendMessage = function(body) {
return this.send({ janus: "message", body: body });
return this.send("message", { body: body });
};

@@ -50,3 +50,3 @@

JanusPluginHandle.prototype.sendJsep = function(jsep) {
return this.send({ janus: "message", body: {}, jsep: jsep });
return this.send("message", { body: {}, jsep: jsep });
};

@@ -56,3 +56,3 @@

JanusPluginHandle.prototype.sendTrickle = function(candidate) {
return this.send({ janus: "trickle", candidate: candidate });
return this.send("trickle", { candidate: candidate });
};

@@ -79,3 +79,3 @@

JanusSession.prototype.create = function() {
return this.send({ janus: "create" }).then(resp => {
return this.send("create").then(resp => {
this.id = resp.data.id;

@@ -88,3 +88,3 @@ return resp;

JanusSession.prototype.destroy = function() {
return this.send({ janus: "destroy" }).then(() => {
return this.send("destroy").then(() => {
this._killKeepalive();

@@ -114,13 +114,16 @@ });

}
if (signal.session_id != this.id) {
console.warn("Incorrect session ID received in Janus signalling message: was " + signal.session_id + ", expected " + this.id + ".");
}
if (signal.transaction != null) {
var handlers = this.txns[signal.transaction];
if (signal.janus === "ack") {
// this is an ack of an asynchronously-processed request, we should wait
var txn = this.txns[signal.transaction];
if (signal.janus === "ack" && txn.type == "message") {
// this is an ack of an asynchronously-processed plugin request, we should wait
// to resolve the promise until the actual response comes in
} else if (handlers != null) {
if (handlers.timeout != null) {
clearTimeout(handlers.timeout);
} else if (txn != null) {
if (txn.timeout != null) {
clearTimeout(txn.timeout);
}
delete this.txns[signal.transaction];
(this.isError(signal) ? handlers.reject : handlers.resolve)(signal);
(this.isError(signal) ? txn.reject : txn.resolve)(signal);
}

@@ -135,7 +138,8 @@ }

**/
JanusSession.prototype.send = function(signal) {
JanusSession.prototype.send = function(type, signal) {
var txid = (this.nextTxId++).toString();
signal = Object.assign({ janus: type, transaction: txid }, signal);
if (this.id != null) { // this.id is undefined in the special case when we're sending the session create message
signal = Object.assign({ session_id: this.id }, signal);
}
signal = Object.assign({ transaction: (this.nextTxId++).toString() }, signal);
if (module.exports.verbose) {

@@ -149,6 +153,6 @@ console.debug("Outgoing Janus signal: ", signal);

delete this.txns[signal.transaction];
reject(new Error("Signalling message timed out."));
reject(new Error("Signalling message with txid " + txid + " timed out."));
}, this.options.timeoutMs);
}
this.txns[signal.transaction] = { resolve: resolve, reject: reject, timeout: timeout };
this.txns[signal.transaction] = { resolve: resolve, reject: reject, timeout: timeout, type: type };
this.output(JSON.stringify(signal));

@@ -160,3 +164,3 @@ this._resetKeepalive();

JanusSession.prototype._keepalive = function() {
return this.send({ janus: "keepalive" });
return this.send("keepalive");
};

@@ -163,0 +167,0 @@

{
"name": "minijanus",
"version": "0.2.1",
"version": "0.3.0",
"description": "Really simple and minimal wrapper for talking to the Janus signalling API.",

@@ -5,0 +5,0 @@ "main": "minijanus.js",

@@ -75,3 +75,3 @@ # minijanus.js

```
$ npm run build
$ yarn build
```

@@ -82,3 +82,3 @@

```
$ npm run test
$ yarn test
```

@@ -7,6 +7,8 @@ var mj = require('./minijanus.js');

var aq = session.send({ transaction: "figs" });
var bq = session.send({ transaction: "wigs" });
var cq = session.send({ transaction: "pigs" });
var trickle = session.send("trickle", { transaction: "bigs" });
var aq = session.send("message", { transaction: "figs" });
var bq = session.send("message", { transaction: "wigs" });
var cq = session.send("message", { transaction: "pigs" });
session.receive({ transaction: "bigs", janus: "ack" });
session.receive({ transaction: "figs", janus: "ack" });

@@ -22,6 +24,7 @@ session.receive({ transaction: "wigs", janus: "ack" });

Promise.all([aq, bq, cq]).then(results => {
t.deepEqual(results[0], { transaction: "figs", cats: "hats" });
t.deepEqual(results[1], { transaction: "wigs" });
t.deepEqual(results[2], { transaction: "pigs", rats: "pats" });
Promise.all([trickle, aq, bq, cq]).then(results => {
t.deepEqual(results[0], { transaction: "bigs", janus: "ack" });
t.deepEqual(results[1], { transaction: "figs", cats: "hats" });
t.deepEqual(results[2], { transaction: "wigs" });
t.deepEqual(results[3], { transaction: "pigs", rats: "pats" });
t.deepEqual(session.txns, {});

@@ -35,7 +38,7 @@ t.end();

var aq = session.send({ transaction: "lazy" }).then(
var aq = session.send("message", { transaction: "lazy" }).then(
resp => { t.fail("Request should have failed!"); return resp; },
err => { t.pass("Timeout should have fired!"); return err; }
);
var bq = session.send({ transaction: "hasty" }).then(
var bq = session.send("message", { transaction: "hasty" }).then(
resp => { t.pass("Request should have succeeded!"); return resp; },

@@ -42,0 +45,0 @@ err => { t.fail("Timeout shouldn't have fired!"); return err; }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc