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

ferrum-db-client

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ferrum-db-client - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

3

dist/client.d.ts

@@ -16,3 +16,4 @@ /// <reference types="node" />

private port;
constructor(socket: Socket);
private hearBeatTimeout;
constructor(socket: Socket, heartBeatTimeout: number);
private initialize;

@@ -19,0 +20,0 @@ reconnect(): void;

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

class FerrumServerClient {
constructor(socket) {
constructor(socket, heartBeatTimeout) {
this.id = 0;

@@ -15,5 +15,6 @@ this.heartBeatPending = false;

this.initialize(socket);
this.hearBeatTimeout = heartBeatTimeout;
this.heartBeatInterval = setInterval(() => {
this.heartbeat();
}, 2000);
}, Math.ceil(this.hearBeatTimeout / 2.5));
}

@@ -105,3 +106,3 @@ initialize(socket) {

async heartbeat() {
if (Date.now() - this.lastResponse > 12000) {
if (Date.now() - this.lastResponse > this.hearBeatTimeout) {
this.socket.destroy(new Error('Heartbeat timeout'));

@@ -108,0 +109,0 @@ return;

@@ -7,3 +7,5 @@ import { FerrumServerClient } from './client';

export { SetRemote } from './set_remote';
export declare function ferrumConnect(ip: string, port: number): Promise<FerrumServerConnection>;
export declare function ferrumConnect(ip: string, port: number, options?: {
heartbeatTimeout: number;
}): Promise<FerrumServerConnection>;
export declare class FerrumServerConnection {

@@ -10,0 +12,0 @@ private client;

@@ -18,3 +18,4 @@ "use strict";

Object.defineProperty(exports, "SetRemote", { enumerable: true, get: function () { return set_remote_1.SetRemote; } });
function ferrumConnect(ip, port) {
const HEARTBEAT_TIMEOUT = 1000 * 30;
function ferrumConnect(ip, port, options) {
return new Promise((resolve, reject) => {

@@ -26,3 +27,4 @@ const socket = new net_1.Socket();

socket.once('connect', () => {
client = new client_1.FerrumServerClient(socket);
var _a;
client = new client_1.FerrumServerClient(socket, (_a = options === null || options === void 0 ? void 0 : options.heartbeatTimeout) !== null && _a !== void 0 ? _a : HEARTBEAT_TIMEOUT);
resolve(new FerrumServerConnection(client));

@@ -29,0 +31,0 @@ });

{
"name": "ferrum-db-client",
"version": "0.2.9",
"version": "0.2.10",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts",

@@ -7,3 +7,2 @@ import { BinaryWriter, Encoding } from 'csharp-binary-stream';

const MAX_BUFFER_SIZE = 512 * 1024 * 1024;
export class FerrumServerClient {

@@ -20,8 +19,10 @@ protected id: number = 0;

private port: number;
private hearBeatTimeout: number;
constructor(socket: Socket) {
constructor(socket: Socket, heartBeatTimeout: number) {
this.initialize(socket);
this.hearBeatTimeout = heartBeatTimeout;
this.heartBeatInterval = setInterval(() => {
this.heartbeat();
}, 2000);
}, Math.ceil(this.hearBeatTimeout / 2.5));
}

@@ -122,3 +123,3 @@

public async heartbeat(): Promise<void> {
if (Date.now() - this.lastResponse > 12000) {
if (Date.now() - this.lastResponse > this.hearBeatTimeout) {
this.socket.destroy(new Error('Heartbeat timeout'));

@@ -125,0 +126,0 @@ return;

@@ -13,3 +13,5 @@ import { Encoding } from 'csharp-binary-stream';

export function ferrumConnect(ip: string, port: number): Promise<FerrumServerConnection> {
const HEARTBEAT_TIMEOUT = 1000 * 30;
export function ferrumConnect(ip: string, port: number, options?: { heartbeatTimeout: number }): Promise<FerrumServerConnection> {
return new Promise((resolve, reject) => {

@@ -22,3 +24,3 @@ const socket = new Socket();

socket.once('connect', () => {
client = new FerrumServerClient(socket);
client = new FerrumServerClient(socket, options?.heartbeatTimeout ?? HEARTBEAT_TIMEOUT);
resolve(new FerrumServerConnection(client));

@@ -25,0 +27,0 @@ });

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