diff --git a/src/index.ts b/src/index.ts index 5855692..aeea1a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,8 +33,16 @@ export class SwarmClient extends Client { async init(): Promise { return this.callModuleReturn("init", { swarm: this.swarm }); } - async ready(): Promise { - return this.callModuleReturn("ready", { swarm: this.swarm }); + async ready(): Promise { + 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 {