Socket
Socket
Sign inDemoInstall

ssb-conn-hub

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-conn-hub - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

3

lib/index.d.ts

@@ -17,6 +17,7 @@ import { ConnectionData as Data, Address } from './types';

private _onRpcConnect;
connect(address: Address): Promise<false | object>;
connect(address: Address, data?: Partial<Data>): Promise<false | object>;
disconnect(address: Address): Promise<boolean>;
reset(): void;
entries(): IterableIterator<[string, Readonly<{
[name: string]: any;
state: "connecting" | "connected" | "disconnecting";

@@ -23,0 +24,0 @@ disconnect?: ((cb: (err?: any) => void) => void) | undefined;

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

};
ConnHub.prototype.connect = function (address) {
ConnHub.prototype.connect = function (address, data) {
return __awaiter(this, void 0, void 0, function () {

@@ -225,3 +225,3 @@ var peer_1, state, key, _a, err, rpc, peer, state_1;

key = inferPublicKey(address);
this._setPeer(address, { state: state, key: key });
this._setPeer(address, __assign({}, data, { state: state, key: key }));
debug('connecting to %s', address);

@@ -228,0 +228,0 @@ this._notifyEvent({ type: state, address: address, key: key });

@@ -6,2 +6,3 @@ export declare type Address = string;

key?: string;
[name: string]: any;
}>;

@@ -8,0 +9,0 @@ export declare type ListenEvent = Readonly<{

{
"name": "ssb-conn-hub",
"description": "Module that manages active connections to SSB peers",
"version": "0.0.6",
"version": "0.0.7",
"homepage": "https://github.com/staltz/ssb-conn-hub",

@@ -36,2 +36,2 @@ "main": "lib/index.js",

"license": "MIT"
}
}

@@ -15,3 +15,3 @@ # ssb-conn-hub

* `connHub.connect(address)`: connect to a peer known by its `address` (string, must conform to the [multiserver address convention](https://github.com/dominictarr/multiserver-address)). Returns a Promise, with the three possible outcomes:
* `connHub.connect(address, data?)`: connect to a peer known by its `address` (string, must conform to the [multiserver address convention](https://github.com/dominictarr/multiserver-address)). The second argument `data` is optional, and allows you to attach additional metadata, that can be read later when this connection data is retrieved. Returns a Promise, with the three possible outcomes:
- Resolves with an RPC object that represents the successfully connected peer

@@ -18,0 +18,0 @@ - Resolves with `false` when the connect was unnecessary, therefore not performed

@@ -151,3 +151,6 @@ import {ConnectionData as Data, ListenEvent, Address} from './types';

public async connect(address: Address): Promise<false | object> {
public async connect(
address: Address,
data?: Partial<Data>,
): Promise<false | object> {
this._assertNotClosed();

@@ -171,3 +174,3 @@ this._assertValidAddress(address);

const key = inferPublicKey(address);
this._setPeer(address, {state, key});
this._setPeer(address, {...data, state, key});
debug('connecting to %s', address);

@@ -174,0 +177,0 @@ this._notifyEvent({type: state, address, key} as ListenEvent);

@@ -7,2 +7,3 @@ export type Address = string;

key?: string;
[name: string]: any;
}>;

@@ -9,0 +10,0 @@

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