LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
  • Stream
  • Overview
  • Getting started
  • injectStream
  • Selectors
  • Interrupts & headless tools
  • Subagents & subgraphs
  • Fork & edit from a checkpoint
  • Submission queue
  • Multimodal media
  • Transports
  • Dependency injection
  • Type safety
  • Migrating to v1
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemoteStream
OverviewGetting startedinjectStreamSelectorsInterrupts & headless toolsSubagents & subgraphsFork & edit from a checkpointSubmission queueMultimodal mediaTransportsDependency injectionType safetyMigrating to v1
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/angularinjectChannelEffect
Function●Since v1.0

injectChannelEffect

Copy
injectChannelEffect(
  stream: AnyStream,
  channels: readonly Channel[] | Signal<readonly Channel[]>
View source on GitHub
,
options
:
InjectChannelEffectOptions
)

Parameters

NameTypeDescription
stream*AnyStream
channels*readonly Channel[] | Signal<readonly Channel[]>
options*InjectChannelEffectOptions

Side-effect counterpart to injectChannel. Instead of returning a signal of buffered events, it invokes onEvent once per event for as long as the owning component / service is alive — the idiomatic place for analytics, logging, and other fire-and-forget side effects.

injectChannelEffect(this.stream, ["lifecycle", "tools"], {
  replay: false,
  onEvent: (event) => sendAnalytics(event),
  onError: (error) => logger.error(error),
});

Reactive channels / target / enabled signals re-bind the subscription when they change. The underlying subscription is shared (ref-counted) with any matching injectChannel consumer. replay defaults to false (live-only); events buffered before the effect attaches are not re-delivered.

Must be called from an injection context (component / directive / service field initializer, or runInInjectionContext(...)).