LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
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
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
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/angularinjectMessages
Function●Since v1.0

injectMessages

Subscribe to a scoped messages stream.

Contract:

  • At the root (no target) this returns stream.messages — the always-on root projection; no extra subscription is opened.
  • For any non-root namespace, call-time triggers a ref-counted messages subscription scoped to that namespace. The subscription is released automatically when the calling component / service is destroyed (and the registry closes the underlying server subscription when the last consumer leaves).

Messages are always BaseMessage class instances from @langchain/core/messages.

Copy
injectMessages(
  stream: AnyStream,
  target: SelectorTarget | Signal<SelectorTarget>
): Signal<BaseMessage<MessageStructure<MessageToolSet>, MessageType>[]>

Parameters

NameTypeDescription
stream*AnyStream
targetSelectorTarget | Signal<SelectorTarget>
View source on GitHub