0.13.3 • Published 6 months ago

@xmpp/resource-binding v0.13.3

Weekly downloads
2,779
License
ISC
Repository
-
Last release
6 months ago

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

const { xmpp } = require("@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).

Uses cases:

  • Have the user choose a resource every time
  • Do not ask for resource before connection is made
  • Debug resource binding
  • Perform an asynchronous operation to get the resource
const { xmpp } = require("@xmpp/client");
const client = xmpp({ resource: bindResource });

async function bindResource(bind) {
  console.debug("bind");
  const value = await prompt("enter resource");
  console.debug("binding");
  try {
    const { resource } = await bind(value);
    console.debug("bound", resource);
  } catch (err) {
    console.error(err);
    throw err;
  }
}

References

RFC 6120 Resource Binding

0.13.3

6 months ago

0.13.1

3 years ago

0.13.0

4 years ago

0.12.1

4 years ago

0.12.0

4 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.2

5 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.4

6 years ago

0.7.0

6 years ago

0.6.2

6 years ago

0.6.0

7 years ago

0.5.0

7 years ago