# @xmpp/resource-binding

> XMPP resource binding for JavaScript

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

## Install

```sh
npm install @xmpp/resource-binding
pnpm add @xmpp/resource-binding
yarn add @xmpp/resource-binding
bun add @xmpp/resource-binding
```

## 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__resource-binding) |
| Module format | ESM + CommonJS |
| Node | >= 20.10 |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2274 |
| Maintainers | sonny |
| Keywords | XMPP, bind, resource |

## Links

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

## Dependencies (1)

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

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.14.0 (latest) — 2025-10-29
- 0.13.3 — 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.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/resource-binding/versions

## README

# resource-binding

Resource binding for `@xmpp/client`.

Included and enabled in `@xmpp/client`.

## Usage

Resource is optional and will be chosen by the server if omitted.

### string

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

const client = xmpp({ resource: "laptop" });
```

### function

Instead, you can provide a function that will be called every time resource binding occurs (every (re)connect).

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

const client = xmpp({ resource: onBind });

async function onBind(bind) {
  const resource = await fetchResource();
  return resource;
}
```

## References

[RFC 6120 Resource Binding](https://xmpp.org/rfcs/rfc6120.html#bind)

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