# YamuxSession

> **Class** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/sandbox/_yamux/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()

## Signature

```python
YamuxSession(
    self,
    conn: _ReadWriteCloser,
)
```

## Constructors

```python
__init__(
    self,
    conn: _ReadWriteCloser,
) -> None
```

| Name | Type |
|------|------|
| `conn` | `_ReadWriteCloser` |


## Properties

- `is_closed`

## Methods

- [`open_stream()`](https://reference.langchain.com/python/langsmith/sandbox/_yamux/YamuxSession/open_stream)
- [`close()`](https://reference.langchain.com/python/langsmith/sandbox/_yamux/YamuxSession/close)

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/6a74bf5af9e542d8065af8edca54b2448f430916/python/langsmith/sandbox/_yamux.py#L185)