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

@relaycorp/ws-mock

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@relaycorp/ws-mock - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0

3

build/main/lib/MockWebSocket.d.ts

@@ -12,2 +12,3 @@ /// <reference types="node" />

protected ownCloseFrame: CloseFrame | null;
protected _wasTerminated: boolean;
protected readonly messagesSent: WSData[];

@@ -19,4 +20,6 @@ protected readonly ownEvents: EventEmitter;

close(code?: number, reason?: string): void;
terminate(): void;
get wasTerminated(): boolean;
makeDuplex(): Duplex;
private requireOpenConnection;
}

@@ -17,2 +17,4 @@ "use strict";

this.ownCloseFrame = null;
// tslint:disable-next-line:readonly-keyword
this._wasTerminated = false;
// tslint:disable-next-line:readonly-array

@@ -77,2 +79,11 @@ this.messagesSent = [];

}
terminate() {
this.requireOpenConnection();
// tslint:disable-next-line:no-object-mutation
this._wasTerminated = true;
this.ownEvents.emit('termination');
}
get wasTerminated() {
return this._wasTerminated;
}
makeDuplex() {

@@ -84,3 +95,5 @@ // tslint:disable-next-line:no-this-assignment

destroy(error, callback) {
connection.emit('close', error ? 1006 : 1005);
if (!connection.wasTerminated) {
connection.emit('close', error ? 1006 : 1005);
}
callback(error);

@@ -98,2 +111,3 @@ },

this.once('close', () => duplex.destroy());
this.ownEvents.once('termination', () => duplex.destroy());
this.once('error', (error) => duplex.destroy(error));

@@ -106,2 +120,5 @@ return duplex;

}
if (this.wasTerminated) {
throw new Error('Connection was terminated');
}
}

@@ -108,0 +125,0 @@ }

@@ -12,2 +12,3 @@ /// <reference types="node" />

protected ownCloseFrame: CloseFrame | null;
protected _wasTerminated: boolean;
protected readonly messagesSent: WSData[];

@@ -19,4 +20,6 @@ protected readonly ownEvents: EventEmitter;

close(code?: number, reason?: string): void;
terminate(): void;
get wasTerminated(): boolean;
makeDuplex(): Duplex;
private requireOpenConnection;
}

@@ -12,2 +12,4 @@ import { EventEmitter } from 'events';

ownCloseFrame = null;
// tslint:disable-next-line:readonly-keyword
_wasTerminated = false;
// tslint:disable-next-line:readonly-array

@@ -71,2 +73,11 @@ messagesSent = [];

}
terminate() {
this.requireOpenConnection();
// tslint:disable-next-line:no-object-mutation
this._wasTerminated = true;
this.ownEvents.emit('termination');
}
get wasTerminated() {
return this._wasTerminated;
}
makeDuplex() {

@@ -78,3 +89,5 @@ // tslint:disable-next-line:no-this-assignment

destroy(error, callback) {
connection.emit('close', error ? 1006 : 1005);
if (!connection.wasTerminated) {
connection.emit('close', error ? 1006 : 1005);
}
callback(error);

@@ -92,2 +105,3 @@ },

this.once('close', () => duplex.destroy());
this.ownEvents.once('termination', () => duplex.destroy());
this.once('error', (error) => duplex.destroy(error));

@@ -100,2 +114,5 @@ return duplex;

}
if (this.wasTerminated) {
throw new Error('Connection was terminated');
}
}

@@ -102,0 +119,0 @@ }

4

package.json
{
"name": "@relaycorp/ws-mock",
"version": "2.4.1",
"version": "2.5.0",
"author": {

@@ -45,3 +45,3 @@ "email": "no-reply@relaycorp.tech",

"prettier": "^2.3.2",
"ts-node": "^10.1.0",
"ts-node": "^10.2.0",
"tslint": "^5.20.1",

@@ -48,0 +48,0 @@ "typedoc": "^0.21.4",

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