Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/samuelagm/nativescript-xmpp-client

An XMPP websocket client for nativescript
https://github.com/samuelagm/nativescript-xmpp-client

nativescript xmpp xmpp-websocket-client

Last synced: 3 months ago
JSON representation

An XMPP websocket client for nativescript

Awesome Lists containing this project

README

        

# nativescript-xmpp-client

## Installation
`tns install nativescript-xmpp-client`

## Usage

``` ts
import {Client, IQ} from "nativescript-xmpp-client";

....

const client = new Client({
websocket: {url: 'ws://127.0.0.1:5280'},
jid: '[email protected]',
password: 'secret'
});

client.on('online', function (data) {
//Request roaster
client.send(new IQ({from: data.jid, type: 'get', id: 'rand'}).c('query', {xmlns: 'jabber:iq:roster'}));
});

client.on('stanza', function (stanza) {
console.log(stanza.root().toString());
});

client.on('error', function (error) {
console.log('client2', error)
})

```

## Improvements
Please feel free to send in PRs, Thanks