# @xmpp/middleware

> XMPP middleware for JavaScript

Latest version **0.14.0** (published 2025-10-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @xmpp/middleware
pnpm add @xmpp/middleware
yarn add @xmpp/middleware
bun add @xmpp/middleware
```

## Health

**Score 58/100 (C)** — status: stable.

Positive: has types package; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.14.0 |
| Published | 2025-10-29 |
| First published | 2018-10-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/xmpp__middleware) |
| Module format | ESM + CommonJS |
| Node | >= 20.10 |
| Dependencies | 4 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2273 |
| Maintainers | sonny |
| Keywords | XMPP, middleware |

## Links

- npm: https://www.npmjs.com/package/@xmpp/middleware
- Repository: https://github.com/xmppjs/xmpp.js
- Homepage: https://github.com/xmppjs/xmpp.js/tree/main/packages/middlware
- Issues: http://github.com/xmppjs/xmpp.js/issues
- npm.io page: https://npm.io/package/@xmpp/middleware

## Dependencies (4)

- [@xmpp/jid](https://npm.io/package/@xmpp/jid.md) ^0.14.0
- [@xmpp/xml](https://npm.io/package/@xmpp/xml.md) ^0.14.0
- [@xmpp/error](https://npm.io/package/@xmpp/error.md) ^0.14.0
- [koa-compose](https://npm.io/package/koa-compose.md) ^4.1.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.14.0 (latest) — 2025-10-29
- 0.13.3 — 2024-12-23
- 0.13.1 — 2022-02-13
- 0.13.0 — 2021-08-28
- 0.12.1 — 2021-08-22
- 0.12.0 — 2020-12-21
- 0.11.0 — 2020-02-14
- 0.10.0 — 2020-02-07
- 0.9.2 — 2020-01-02
- 0.9.1 — 2019-11-23
- 0.9.0 — 2019-11-19
- 0.8.0 — 2019-10-06
- 0.7.4 — 2019-06-15
- 0.7.0 — 2019-02-03
- 0.6.2 — 2019-01-07
- … 2 more at https://npm.io/package/@xmpp/middleware/versions

## README

# middleware

Middleware for `@xmpp/client` and `@xmpp/component`.

Supports Node.js and browsers.

## Install

```sh
npm install @xmpp/middleware
```

## Usage

```js
import { Client } from "@xmpp/client";
import middleware from "@xmpp/middleware";

const client = new Client();
const app = middleware({ entity: client });
```

### use

The `use` method registers a middleware for incoming stanzas.

```js
app.use((ctx, next) => {});
```

### filter

The `filter` method registers a middleware for outgoing stanzas.

```js
app.filter((ctx, next) => {});
```

---
_Source: https://npm.io/package/@xmpp/middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
