*add send method to broadcast to one peer
This commit is contained in:
parent
ce3a3fa8ad
commit
d61076be57
13
src/index.ts
13
src/index.ts
|
@ -141,4 +141,17 @@ export default class DHTFlood extends EventEmitter {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
send(peer: any, data: any, ttl = this.ttl) {
|
||||
this.messageNumber++;
|
||||
const { id, messageNumber } = this;
|
||||
|
||||
const message = this.setupPeer(peer);
|
||||
message.send({
|
||||
originId: id,
|
||||
messageNumber,
|
||||
ttl,
|
||||
data: b4a.from(data),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue