# @xmpp/reconnect

> XMPP reconnect for JavaScript

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

## Install

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

## 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 | 2016-11-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/xmpp__reconnect) |
| Module format | ESM + CommonJS |
| Node | >= 20.10 |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2273 |
| Maintainers | sonny |
| Keywords | XMPP, reconnect |

## Links

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

## Dependencies (1)

- [@xmpp/events](https://npm.io/package/@xmpp/events.md) ^0.14.0

## Recent versions

- 0.14.0 (latest) — 2025-10-29
- 0.13.2 — 2024-12-23
- 0.13.1 — 2022-02-16
- 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.0 — 2019-11-19
- 0.8.0 — 2019-10-06
- 0.7.0 — 2019-02-03
- 0.6.1 — 2018-11-30
- 0.6.0 — 2018-11-24
- 0.5.1 — 2018-10-21
- 0.5.0 — 2018-10-07
- … 1 more at https://npm.io/package/@xmpp/reconnect/versions

## README

# reconnect

Auto reconnect for `@xmpp/client` and `@xmpp/component`.

Included and enabled in `@xmpp/component` and `@xmpp/client`.

Supports Node.js and browsers.

Each reconnect will re-use the options provided to the entity `start` method.

## delay property

Property to set/get the delay in milliseconds between connection closed and
reconnecting.

Default is `1000`.

```js
reconnect.delay; // 1000
reconnect.delay = 2000;
```

## reconnecting event

Emitted each time a re-connection is attempted.

```js
reconnect.on("reconnecting", () => {
  console.log("reconnecting");
});
```

## reconnected event

Emitted each time a re-connection succeed.

```js
reconnect.on("reconnected", () => {
  console.log("reconnected");
});
```

## error event

Emitted on entity each time a re-connection fails.

```js
entity.on("error", (err) => {
  console.error(err);
});
```

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