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

@arashi/sockets

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arashi/sockets - npm Package Compare versions

Comparing version 0.0.0-dev.8 to 0.0.0-dev.9

19

lib/Socket.js

@@ -94,7 +94,10 @@ "use strict";

return new Promise((resolve, reject) => {
this._socket.once('error', (error) => {
let connectCallback = null;
let errCallback = (error) => {
this._socket.removeListener('connect', connectCallback);
reject(error);
});
this._socket.once('connect', async () => {
};
connectCallback = async () => {
this._connected = true;
this._socket.removeListener('error', errCallback);
if (this._app.isClient()) {

@@ -104,3 +107,5 @@ await this._app.getPacketFactory().createConnectionRequestPacket().send(this);

resolve();
});
};
this._socket.once('error', errCallback);
this._socket.once('connect', connectCallback);
this._socket.connect(port, host);

@@ -126,6 +131,8 @@ });

if (this.isConnected()) {
this._socket.once('error', (err) => {
let errCallback = (err) => {
reject(err);
});
};
this._socket.once('error', errCallback);
this._socket.write(packet.serialize(), () => {
this._socket.removeListener('error', errCallback);
if (packet.isResponseRequired() && !this._contexts[packet.getID()]) {

@@ -132,0 +139,0 @@ this._createContext(packet, new PromiseWrapper_1.PromiseWrapper(resolve, reject));

{
"name": "@arashi/sockets",
"version": "0.0.0-dev.8",
"version": "0.0.0-dev.9",
"description": "Networking Library",

@@ -5,0 +5,0 @@ "main": "lib/api.js",

@@ -143,8 +143,11 @@

return new Promise<void>((resolve, reject) => {
this._socket.once('error', (error: Error) => {
let connectCallback: (() => void) = null;
let errCallback = (error: Error) => { // Needs to reference connectCallback
this._socket.removeListener('connect', connectCallback);
reject(error);
});
this._socket.once('connect', async () => {
}
connectCallback = async () => { // Needs to reference errCallback
this._connected = true;
this._socket.removeListener('error', errCallback);
if (this._app.isClient()) {

@@ -155,3 +158,5 @@ await this._app.getPacketFactory().createConnectionRequestPacket().send(this);

resolve();
});
}
this._socket.once('error', errCallback);
this._socket.once('connect', connectCallback);
this._socket.connect(port, host);

@@ -183,6 +188,8 @@ });

// Writable.write error callback is unreliable and may or may not notify of errors.
this._socket.once('error', (err: Error) => {
let errCallback = (err: Error) => {
reject(err);
});
}
this._socket.once('error', errCallback);
this._socket.write(packet.serialize(), () => {
this._socket.removeListener('error', errCallback);
if (packet.isResponseRequired() && !this._contexts[packet.getID()]) {

@@ -189,0 +196,0 @@ this._createContext(packet, new PromiseWrapper<TPacketResponse>(resolve, reject));

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