# UnixSocketEventSource

> **Class** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/event_bus/UnixSocketEventSource)

Line-delimited JSON event source over a local Unix domain socket.

The listener creates its parent directory with mode `0o700` and binds the
socket inside it under a transient `umask(0o077)` so the socket inherits
`0o600` from the moment of `bind()`. Stale sockets at the configured path
are removed on start, but only after a `stat` confirms the path is a
socket — a regular file or directory at that path is left untouched and
causes start to fail loudly.

## Signature

```python
UnixSocketEventSource(
    self,
    path: Path | None = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `Path \| None` | No | Socket path. When omitted, a per-process path under the runtime or temp directory is used. (default: `None`) |

## Constructors

```python
__init__(
    self,
    path: Path | None = None,
) -> None
```

| Name | Type |
|------|------|
| `path` | `Path \| None` |


## Properties

- `path`

## Methods

- [`start()`](https://reference.langchain.com/python/deepagents-code/event_bus/UnixSocketEventSource/start)
- [`serve_forever()`](https://reference.langchain.com/python/deepagents-code/event_bus/UnixSocketEventSource/serve_forever)
- [`stop()`](https://reference.langchain.com/python/deepagents-code/event_bus/UnixSocketEventSource/stop)

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/d1c6946218b4f0f86ab7b02b6bb6af1e4b75cede/libs/code/deepagents_code/event_bus.py#L116)