New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect.io

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect.io - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

17

libs/port.js

@@ -61,5 +61,19 @@ import EventEmitter from 'events';

} );
// 这个回调说明连接是被远程端口断开的
port.onDisconnect.addListener( ()=> {
this.emit( 'disconnect' );
this.emit( 'disconnect' , true ); // true 表明连接是被远程端口断开的
} );
this.on( 'disconnect' ,
/**
* 当连接断开时,告诉所有等待响应的消息一个错误
* @param {Boolean} isRemote - 连接是否是被远程端口断开的
*/
isRemote => {
for ( let key in waitingResponseMsg ) {
waitingResponseMsg[ key ]( undefined , `Connection has been disconnected by ${isRemote ? 'Server' : 'Client'}.` );
delete waitingResponseMsg[ key ];
}
} );
}

@@ -98,2 +112,3 @@

this.port.disconnect();
this.emit( 'disconnect' , false );
}

@@ -100,0 +115,0 @@ }

@@ -32,2 +32,7 @@ import EventEmitter from 'events';

/**
* 初始化服务端的端口
* @param {chrome.runtime.Port} chromePort
* @param {Boolean} isExternal - 此连接是否为外部连接
*/
function initServerPort( chromePort , isExternal ) {

@@ -34,0 +39,0 @@ const port = new Port( chromePort );

2

package.json
{
"name": "connect.io",
"version": "0.1.4",
"version": "0.1.5",
"description": "chrome.runtime.connect wrapper that using Stock.IO API.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -24,3 +24,10 @@ # connect.io

// get message acknowledgements
client.send('report clients number', (number) => {
client.send('report clients number', (number, error) => {
// When connection has been disconnected until get response, then error will be a string.
// It's often happened when you connect to a tab from extension but you don't have permission. (etc chrome:// 、chrome-extension://)
if( error ) {
throw new Error(error);
}
console.log(number); // 100

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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