npm.io
0.14.0 • Published 10 months ago

@xmpp/resource-binding

Licence
ISC
Version
0.14.0
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
2.3K

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

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).

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

Keywords