LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmithsandbox_yamuxYamuxSession
Class●Since v0.7

YamuxSession

Client-side yamux session over a byte-stream connection.

The connection must implement read(n) -> bytes, write(data) -> int, and close() -> None. Typically this is a :class:_WSAdapter wrapping a WebSocket.

Usage::

session = YamuxSession(conn)
stream = session.open_stream()
stream.write(b"hello")
data = stream.read(1024)
stream.close()
session.close()
Copy
YamuxSession(
    self,
    conn: _ReadWriteCloser,
)

Constructors

constructor
__init__
NameType
conn_ReadWriteCloser

Attributes

attribute
is_closed: bool

Methods

method
open_stream

Open a new multiplexed stream.

Raises :class:RuntimeError if the session is closed.

method
close

Close the session and all streams.

View source on GitHub