@geckos.io/common
Advanced tools
Comparing version 1.6.1 to 1.7.0
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var helpers_1 = require("./helpers"); | ||
var constants_1 = require("./constants"); | ||
var object_sizeof_1 = __importDefault(require("object-sizeof")); | ||
var SendMessage = function (dataChannel, maxMessageSize, eventName, data) { | ||
@@ -13,3 +9,5 @@ var _a; | ||
var send = function (data) { | ||
if (typeof maxMessageSize === 'number' && object_sizeof_1.default(data) > maxMessageSize) | ||
var _a; | ||
var bytes = (_a = data.byteLength) !== null && _a !== void 0 ? _a : data.length * 2; // (times 2 for characters that uses 2 bytes per char) | ||
if (typeof maxMessageSize === 'number' && bytes > maxMessageSize) | ||
throw new Error("maxMessageSize of " + maxMessageSize + " exceeded"); | ||
@@ -16,0 +14,0 @@ else |
/// <reference types="node" /> | ||
import http from 'http'; | ||
import { IncomingMessage } from 'http'; | ||
declare const ArrayBufferView: any; | ||
@@ -23,3 +23,15 @@ export { ArrayBufferView }; | ||
autoManageBuffering?: boolean; | ||
authorization?: (header: string | undefined) => Promise<boolean | any>; | ||
/** Set a custom port range for the WebRTC connection. */ | ||
portRange?: { | ||
/** Minimum port range (defaults to 0) */ | ||
min: number; | ||
/** Minimum port range (defaults to 65535) */ | ||
max: number; | ||
}; | ||
/** | ||
* A async function to authenticate and authorize a user. | ||
* @param auth The authentication token | ||
* @param request The incoming http request | ||
*/ | ||
authorization?: (auth: string | undefined, request: IncomingMessage) => Promise<boolean | any>; | ||
} | ||
@@ -39,3 +51,3 @@ export interface ClientOptions { | ||
} | ||
declare type CorsOptionsOriginFunction = (req: http.IncomingMessage) => string; | ||
declare type CorsOptionsOriginFunction = (req: IncomingMessage) => string; | ||
export interface CorsOptions { | ||
@@ -57,5 +69,2 @@ origin: string | CorsOptionsOriginFunction; | ||
} | ||
export interface ConnectionEventCallbackServer { | ||
(channel: any): void; | ||
} | ||
export interface DisconnectEventCallbackServer { | ||
@@ -62,0 +71,0 @@ (connectionState: 'disconnected' | 'failed' | 'closed'): void; |
{ | ||
"name": "@geckos.io/common", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"description": "The common module for @geckos.io/server and @geckos.io/client.", | ||
@@ -28,4 +28,3 @@ "main": "lib", | ||
"dependencies": { | ||
"eventemitter3": "^4.0.0", | ||
"object-sizeof": "^1.6.0" | ||
"eventemitter3": "^4.0.4" | ||
}, | ||
@@ -32,0 +31,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23273
1
332
- Removedobject-sizeof@^1.6.0
- Removedbase64-js@1.5.1(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedieee754@1.2.1(transitive)
- Removedobject-sizeof@1.6.3(transitive)
Updatedeventemitter3@^4.0.4