# node-xmpp-client

> XMPP client for JavaScript

Latest version **3.2.0** (published 2017-03-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install node-xmpp-client
pnpm add node-xmpp-client
yarn add node-xmpp-client
bun add node-xmpp-client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2017-03-03 |
| First published | 2013-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/node-xmpp-client) |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2275 |
| Maintainers | lloydwatkin, chris-rock, astro, sonny |
| Keywords | client, XMPP, C2S, WebSocket, BOSH |

## Links

- npm: https://www.npmjs.com/package/node-xmpp-client
- Repository: https://github.com/node-xmpp/node-xmpp
- Homepage: http://github.com/node-xmpp/node-xmpp
- Issues: http://github.com/node-xmpp/node-xmpp/issues
- npm.io page: https://npm.io/package/node-xmpp-client

## Dependencies (7)

- [ws](https://npm.io/package/ws.md) ^1.1.1
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [md5.js](https://npm.io/package/md5.js.md) ^1.3.3
- [request](https://npm.io/package/request.md) ^2.65.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [node-xmpp-core](https://npm.io/package/node-xmpp-core.md) ^5.0.9
- [browser-request](https://npm.io/package/browser-request.md) ^0.3.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2017-03-03
- 3.1.3 — 2017-02-14
- 3.1.2 — 2016-12-10
- 3.1.1 — 2016-12-06
- 3.1.0 — 2016-11-20
- 3.0.4 — 2016-10-16
- 3.0.3 — 2016-10-16
- 3.0.2 — 2016-07-01
- 6.1.0 — 2016-06-13
- 3.0.1 — 2016-05-19
- 3.0.0 — 2015-11-18
- 2.1.0 — 2015-11-04
- 2.0.2 — 2015-10-08
- 2.0.1 — 2015-10-07
- 2.0.0 — 2015-10-06
- … 44 more at https://npm.io/package/node-xmpp-client/versions

## README

# node-xmpp-client

XMPP client for JavaScript.

[![build status](https://img.shields.io/travis/node-xmpp/node-xmpp-client/master.svg?style=flat-square)](https://travis-ci.org/node-xmpp/node-xmpp-client/branches)
[![Coverage Status](https://img.shields.io/coveralls/node-xmpp/node-xmpp-client.svg?style=flat-square)](https://coveralls.io/r/node-xmpp/node-xmpp-client)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)


## Manual

See http://node-xmpp.org/doc/client.html for instructions on how to use `node-xmpp-client`.

## Installation

```
npm install node-xmpp-client
```

### Testing

Install the dev dependencies, then...

```npm test```

To run the tests and the code style checks then use:

```grunt test```

Also see the tests run in [travis](http://travis-ci.org/node-xmpp/node-xmpp-client). The tests in travis run both the code and code style tests.

## How to use

Please see the various [examples](https://github.com/node-xmpp/node-xmpp-client/tree/master/examples).

## Features

* Node.js and browsers
* Client authentication with SASL
  - DIGEST-MD5
  - PLAIN
  - ANONYMOUS
  - EXTERNAL
  - [X-OAUTH2](https://developers.google.com/talk/jep_extensions/oauth)
  - ~~X-FACEBOOK-PLATFORM~~ ([removed](https://developers.facebook.com/docs/chat) by Facebook)
* Multiple transports
  - TCP
  - BOSH
  - WebSocket
* `_xmpp-client._tcp` SRV record support

## Dependencies

* [node-xmpp-core](https://github.com/node-xmpp/ltx): `node-xmpp` core libraries

### Building XML Elements

Strophe.js' XML Builder is very convenient for producing XMPP
stanzas. ltx includes it in a much more primitive way: the
`c()`, `cnode()` and `t()` methods can be called on any *Element*
object, returning the new child element.

This can be confusing: in the end, you will hold the last-added child
until you use `up()`, a getter for the parent. `Connection.send()`
first invokes `tree()` to retrieve the uppermost parent, the XMPP
stanza, before sending it out the wire.

## Browser Support

`node-xmpp-client` now comes with a prebuilt browser bundle:

```html
<script src="/node_modules/node-xmpp-client/bundle.js"></script>
<script type="text/javascript">
    var client = new XMPP.Client(opts);
</script>
```

# Keepalives

Rather than send empty packets in order to keep any socket alive please try the following:

```
this.client.connection.socket.setTimeout(0)
this.client.connection.socket.setKeepAlive(true, 10000)
```

Where `this.client` is the result of `new require('node-xmpp-client')()`.

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