*On the ready method, setup a connection to the swarm module to listen for new connections

This commit is contained in:
Derrick Hammer 2023-02-06 03:13:32 -05:00
parent 2bcd37e271
commit fe04cbe10d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 2 deletions

View File

@ -33,8 +33,16 @@ export class SwarmClient extends Client {
async init(): Promise<ErrTuple> {
return this.callModuleReturn("init", { swarm: this.swarm });
}
async ready(): Promise<ErrTuple> {
return this.callModuleReturn("ready", { swarm: this.swarm });
async ready(): Promise<void> {
await this.callModuleReturn("ready", { swarm: this.swarm });
this.connectModule(
"listenConnections",
{ swarm: this.swarm },
(socketId: any) => {
this.emit("connection", createClient(socketId));
}
);
}
public async addRelay(pubkey: string): Promise<void> {