Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@geckos.io/client

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geckos.io/client - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

lib/geckos/channel.d.ts

2

lib/bundle.d.ts

@@ -1,3 +0,3 @@

import client from './client';
import client from './geckos/channel';
export default client;
//# sourceMappingURL=bundle.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var client_1 = __importDefault(require("./client"));
exports.default = client_1.default;
var channel_1 = __importDefault(require("./geckos/channel"));
exports.default = channel_1.default;
//# sourceMappingURL=bundle.js.map

@@ -1,5 +0,5 @@

import client, { ClientChannel } from './client';
import { Data, RawMessage, ChannelId } from '@geckos.io/common/lib/typings';
import client, { ClientChannel } from './geckos/channel';
import { Data, RawMessage, ChannelId } from '@geckos.io/common/lib/types';
export default client;
export type { ClientChannel, Data, RawMessage, ChannelId };
//# sourceMappingURL=index.d.ts.map

@@ -22,4 +22,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var client_1 = __importStar(require("./client"));
exports.default = client_1.default;
var channel_1 = __importStar(require("./geckos/channel"));
exports.default = channel_1.default;
//# sourceMappingURL=index.js.map
import { Bridge } from '@geckos.io/common/lib/bridge';
import { RawMessage, Data, ChannelId, EventName } from '@geckos.io/common/lib/typings';
import { RawMessage, Data, ChannelId, EventName } from '@geckos.io/common/lib/types';
interface RTCRemotePeerConnection {

@@ -9,2 +9,3 @@ id: ChannelId;

url: string;
authorization: string | undefined;
label: string;

@@ -19,3 +20,3 @@ rtcConfiguration: RTCConfiguration;

emit(eventName: EventName, data?: Data | RawMessage | null): void;
constructor(url: string, label: string, rtcConfiguration: RTCConfiguration);
constructor(url: string, authorization: string | undefined, label: string, rtcConfiguration: RTCConfiguration);
onDataChannel: (ev: RTCDataChannelEvent) => void;

@@ -26,3 +27,3 @@ fetchAdditionalCandidates(host: string, id: ChannelId): Promise<void>;

dataChannel: RTCDataChannel;
id: ChannelId;
id: string | undefined;
}>;

@@ -29,0 +30,0 @@ }

@@ -54,9 +54,9 @@ "use strict";

var bridge_1 = require("@geckos.io/common/lib/bridge");
var constants_1 = require("@geckos.io/common/lib/constants");
var parseMessage_1 = __importDefault(require("@geckos.io/common/lib/parseMessage"));
var sendMessage_1 = __importDefault(require("@geckos.io/common/lib/sendMessage"));
var ConnectionsManagerClient = /** @class */ (function () {
function ConnectionsManagerClient(url, label, rtcConfiguration) {
function ConnectionsManagerClient(url, authorization, label, rtcConfiguration) {
var _this = this;
this.url = url;
this.authorization = authorization;
this.label = label;

@@ -77,3 +77,2 @@ this.rtcConfiguration = rtcConfiguration;

};
_this.bridge.emit(constants_1.EVENTS.DATA_CHANNEL_IS_OPEN);
};

@@ -115,26 +114,28 @@ }

return __awaiter(this, void 0, void 0, function () {
var host, res, _a, error_1, _b, id, localDescription, configuration, RTCPc, showBackOffIntervals, originalAnswer, updatedAnswer, error_2, error_3;
var host, headers, res, _a, error_1, _b, id, localDescription, configuration, RTCPc, showBackOffIntervals, originalAnswer, updatedAnswer, error_2, waitForDataChannel, error_3;
var _c;
var _this = this;
return __generator(this, function (_c) {
switch (_c.label) {
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
host = this.url + "/.wrtc/v1";
_c.label = 1;
headers = { 'Content-Type': 'application/json' };
if (this.authorization)
headers = __assign(__assign({}, headers), (_c = {}, _c['Authorization'] = this.authorization, _c));
_d.label = 1;
case 1:
_c.trys.push([1, 4, , 5]);
_d.trys.push([1, 4, , 5]);
return [4 /*yield*/, fetch(host + "/connections", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
headers: headers
})];
case 2:
res = _c.sent();
res = _d.sent();
_a = this;
return [4 /*yield*/, res.json()];
case 3:
_a.remotePeerConnection = _c.sent();
_a.remotePeerConnection = _d.sent();
return [3 /*break*/, 5];
case 4:
error_1 = _c.sent();
error_1 = _d.sent();
console.error(error_1.message);

@@ -167,12 +168,12 @@ return [3 /*break*/, 5];

});
_c.label = 6;
_d.label = 6;
case 6:
_c.trys.push([6, 14, , 15]);
_d.trys.push([6, 16, , 17]);
return [4 /*yield*/, this.localPeerConnection.setRemoteDescription(localDescription)];
case 7:
_c.sent();
this.localPeerConnection.addEventListener('datachannel', this.onDataChannel);
_d.sent();
this.localPeerConnection.addEventListener('datachannel', this.onDataChannel, { once: true });
return [4 /*yield*/, this.localPeerConnection.createAnswer()];
case 8:
originalAnswer = _c.sent();
originalAnswer = _d.sent();
updatedAnswer = new RTCSessionDescription({

@@ -184,6 +185,6 @@ type: 'answer',

case 9:
_c.sent();
_c.label = 10;
_d.sent();
_d.label = 10;
case 10:
_c.trys.push([10, 12, , 13]);
_d.trys.push([10, 12, , 13]);
return [4 /*yield*/, fetch(host + "/connections/" + id + "/remote-description", {

@@ -197,9 +198,22 @@ method: 'POST',

case 11:
_c.sent();
_d.sent();
return [3 /*break*/, 13];
case 12:
error_2 = _c.sent();
error_2 = _d.sent();
console.error(error_2.message);
return [3 /*break*/, 13];
case 13: return [2 /*return*/, {
case 13:
waitForDataChannel = function () {
return new Promise(function (resolve) {
_this.localPeerConnection.addEventListener('datachannel', function () {
resolve();
}, { once: true });
});
};
if (!!this.dataChannel) return [3 /*break*/, 15];
return [4 /*yield*/, waitForDataChannel()];
case 14:
_d.sent();
_d.label = 15;
case 15: return [2 /*return*/, {
localPeerConnection: this.localPeerConnection,

@@ -209,8 +223,8 @@ dataChannel: this.dataChannel,

}];
case 14:
error_3 = _c.sent();
case 16:
error_3 = _d.sent();
console.error(error_3.message);
this.localPeerConnection.close();
throw error_3;
case 15: return [2 /*return*/];
case 17: return [2 /*return*/];
}

@@ -217,0 +231,0 @@ });

import ConnectionsManagerClient from './connectionsManager';
import { ChannelId } from '@geckos.io/common/lib/typings';
import { ChannelId } from '@geckos.io/common/lib/types';
export default class PeerConnection {

@@ -4,0 +4,0 @@ localPeerConnection: RTCPeerConnection;

{
"name": "@geckos.io/client",
"version": "1.5.0",
"version": "1.6.0",
"description": "Real-time client/server communication over UDP using WebRTC and Node.js",

@@ -40,5 +40,4 @@ "main": "lib/index.js",

"scripts": {
"bundle": "npm run bundle:version && npm run bundle:latest",
"bundle": "npm run bundle:version",
"bundle:version": "../../node_modules/.bin/webpack --config webpack/webpack.prod.js --path=../../../bundles --packageVersion=${npm_package_version}",
"bundle:latest": "../../node_modules/.bin/webpack --config webpack/webpack.prod.js --path=../../../bundles/latest --packageVersion=latest",
"build": "tsc --build tsconfig.json",

@@ -48,3 +47,3 @@ "prepublishOnly": "npm run build"

"dependencies": {
"@geckos.io/common": "^1.5.0"
"@geckos.io/common": "^1.6.0"
},

@@ -51,0 +50,0 @@ "funding": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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