*emit setup event to allow setup of a socket before triggering the connection event
*add a link to the parent swarm in the socket to call emit
This commit is contained in:
parent
4541386514
commit
a9bc1e3a73
|
@ -165,9 +165,12 @@ export class Socket extends Client {
|
|||
|
||||
private syncMutex = new Mutex();
|
||||
|
||||
constructor(id: number) {
|
||||
private swarm: SwarmClient;
|
||||
|
||||
constructor(id: number, swarm: SwarmClient) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.swarm = swarm;
|
||||
}
|
||||
|
||||
private _remotePublicKey?: Uint8Array;
|
||||
|
@ -194,6 +197,8 @@ export class Socket extends Client {
|
|||
private async _initSync() {
|
||||
const mux = Protomux.from(this);
|
||||
|
||||
this.swarm.emit("setup", this);
|
||||
|
||||
let updateDone = defer();
|
||||
|
||||
const [update] = this.connectModule(
|
||||
|
|
Loading…
Reference in New Issue