channel()
channel(topic: string, params?: RealtimeChannelOptions): RealtimeChannel
Create or reuse a channel. The SDK prefixes the topic with realtime:. The same topic returns the existing channel.
Parameters
topic
string
Channel name, any string
params
RealtimeChannelOptions
Response
RealtimeChannel
RealtimeChannel
Channel instance
Example
const channel = realtime.channel("room", {
config: {
private: false,
broadcast: { self: true },
presence: { key: "user-1" },
},
});