Created
April 22, 2022 13:11
-
-
Save thisisjofrank/df74a2994e3dc860df8839e2c291922c to your computer and use it in GitHub Desktop.
The connect method is going to subscribe to the presence event on the channel, passing the onSwarmPresenceChanged callback to be called when an event occurs. Once subscribed, we're going to enter presence, with a state of "connected", and call the onConnection callback:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async connect() { | |
this.channel.presence.subscribe(this.onPresenceChanged.bind(this)); | |
await this.channel.presence.enter('connected'); | |
this.onConnection(this.channel); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment