Created
April 22, 2022 13:10
-
-
Save thisisjofrank/58157ccbcbde01c5f105afd6634761e0 to your computer and use it in GitHub Desktop.
he constructor takes a channelName to connect to, and generates an id for this client. In this implementation, we create a new Ably instance, and connect to the channelName which was given, passing a generated clientId.
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
constructor(channelName: string) { | |
this.id = Math.floor(Math.random() * 1000000) + ""; | |
this.ably = new Ably.Realtime({ key: "api-key-here", clientId: this.id }); | |
this.channel = this.ably.channels.get(channelName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment