*On the ready method, setup a connection to the swarm module to listen for new connections
This commit is contained in:
parent
2bcd37e271
commit
fe04cbe10d
12
src/index.ts
12
src/index.ts
|
@ -33,8 +33,16 @@ export class SwarmClient extends Client {
|
||||||
async init(): Promise<ErrTuple> {
|
async init(): Promise<ErrTuple> {
|
||||||
return this.callModuleReturn("init", { swarm: this.swarm });
|
return this.callModuleReturn("init", { swarm: this.swarm });
|
||||||
}
|
}
|
||||||
async ready(): Promise<ErrTuple> {
|
async ready(): Promise<void> {
|
||||||
return this.callModuleReturn("ready", { swarm: this.swarm });
|
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> {
|
public async addRelay(pubkey: string): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue