Creates a PregelNode that subscribes to a single channel. This is used to define how nodes receive input from channels.
subscribeTo(channel: string, options: SingleChannelSubscriptionOptions): PregelNode| Name | Type | Description |
|---|---|---|
channel* | string | Single channel name to subscribe to |
options | SingleChannelSubscriptionOptions | Subscription options |
// Subscribe to a single channel
const node = Channel.subscribeTo("messages");
// Subscribe to multiple channels
const node = Channel.subscribeTo(["messages", "state"]);
// Subscribe with a custom key
const node = Channel.subscribeTo("messages", { key: "chat" });