Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot 29a12e7baf chore(release): 0.1.0-develop.27 [skip ci]
# [0.1.0-develop.27](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.26...v0.1.0-develop.27) (2023-09-01)

### Features

* add eventemitter support on p2p service and have the handshakedone message emit peerConnected ([b34b7a3](b34b7a3a01))
2023-09-01 23:50:39 +00:00
Derrick Hammer c360b8b1ce
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 19:49:50 -04:00
Derrick Hammer b34b7a3a01
feat: add eventemitter support on p2p service and have the handshakedone message emit peerConnected 2023-09-01 19:49:42 -04:00
5 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,10 @@
# [0.1.0-develop.27](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.26...v0.1.0-develop.27) (2023-09-01)
### Features
* add eventemitter support on p2p service and have the handshakedone message emit peerConnected ([b34b7a3](https://git.lumeweb.com/LumeWeb/libs5/commit/b34b7a3a0172adf0b0ce1476f6c68912dcd05576))
# [0.1.0-develop.26](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.25...v0.1.0-develop.26) (2023-09-01)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.26",
"version": "0.1.0-develop.27",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.26",
"version": "0.1.0-develop.27",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.26",
"version": "0.1.0-develop.27",
"type": "module",
"main": "lib/index.js",
"repository": {

View File

@ -60,4 +60,5 @@ export default async function (
p2p.sendPublicPeersToPeer(p, [peer]);
}
}
p2p.emit("peerConnected", peer);
}

View File

@ -26,8 +26,9 @@ import {
createTransportSocket,
} from "#transports/index.js";
import messages from "#messages/index.js";
import { EventEmitter } from "events";
export class P2PService {
export class P2PService extends EventEmitter {
private logger: Logger;
private nodeKeyPair: KeyPairEd25519;
private localNodeId?: NodeId;
@ -39,6 +40,7 @@ export class P2PService {
>;
constructor(node: S5Node) {
super();
this._node = node;
this._networkId = node.config.p2p?.network;
this.nodeKeyPair = node.config.keyPair;