@@ -182,6 +182,11 @@ export default class RealtimeChannel {
182182 private : boolean
183183
184184 /**
185+ * Creates a channel that can broadcast messages, sync presence, and listen to Postgres changes.
186+ *
187+ * The topic determines which realtime stream you are subscribing to. Config options let you
188+ * enable acknowledgement for broadcasts, presence tracking, or private channels.
189+ *
185190 * @example
186191 * ```ts
187192 * import RealtimeClient from '@supabase/realtime-js'
@@ -364,10 +369,20 @@ export default class RealtimeChannel {
364369 return this
365370 }
366371
372+ /**
373+ * Returns the current presence state for this channel.
374+ *
375+ * The shape is a map keyed by presence key (for example a user id) where each entry contains the
376+ * tracked metadata for that user.
377+ */
367378 presenceState < T extends { [ key : string ] : any } = { } > ( ) : RealtimePresenceState < T > {
368379 return this . presence . state as RealtimePresenceState < T >
369380 }
370381
382+ /**
383+ * Sends the supplied payload to the presence tracker so other subscribers can see that this
384+ * client is online. Use `untrack` to stop broadcasting presence for the same key.
385+ */
371386 async track (
372387 payload : { [ key : string ] : any } ,
373388 opts : { [ key : string ] : any } = { }
@@ -382,6 +397,9 @@ export default class RealtimeChannel {
382397 )
383398 }
384399
400+ /**
401+ * Removes the current presence state for this client.
402+ */
385403 async untrack ( opts : { [ key : string ] : any } = { } ) : Promise < RealtimeChannelSendResponse > {
386404 return await this . send (
387405 {
@@ -658,6 +676,10 @@ export default class RealtimeChannel {
658676 }
659677 }
660678
679+ /**
680+ * Updates the payload that will be sent the next time the channel joins (reconnects).
681+ * Useful for rotating access tokens or updating config without re-creating the channel.
682+ */
661683 updateJoinPayload ( payload : { [ key : string ] : any } ) : void {
662684 this . joinPush . updatePayload ( payload )
663685 }
0 commit comments