Registry / communication / nativescript-xmpp-client

nativescript-xmpp-client

JSON →
library1.2.0jsnpmunverified

A NativeScript plugin providing an XMPP websocket client for iOS and Android. Version 1.2.0 is the current stable release, but it is no longer actively maintained. It uses a stanza-based approach similar to Node-XMPP, with event-driven handling for online, stanza, and error events. Key differentiators: tight integration with NativeScript's runtime, TypeScript support, and WebSocket-only transport (no BOSH).

npm install nativescript-xmpp-client
INSTALL
IMPORT
SIG · NATIVESCRIPT-XMPP-
N
nativescript-xmpp-client
communicationjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
import { Client } from 'nativescript-xmpp-client'
const Client = require('nativescript-xmpp-client').Client
Default export is not provided; always use named import.
IQ
import { IQ } from 'nativescript-xmpp-client'
Used to build IQ stanzas. Also exported: Message, Presence, Stanza.
Message
import { Message } from 'nativescript-xmpp-client'
Used to build Message stanzas.

Initializes an XMPP client with websocket connection, logs in, sends a roster IQ, and logs stanzas.

import { Client, IQ } from 'nativescript-xmpp-client'; const client = new Client({ websocket: { url: 'ws://127.0.0.1:5280' }, jid: 'user@127.0.0.1', password: 'secret' }); client.on('online', (data) => { console.log('Online:', data.jid); const rosterIQ = new IQ({ from: data.jid, type: 'get', id: 'roster1' }).c('query', { xmlns: 'jabber:iq:roster' }); client.send(rosterIQ); }); client.on('stanza', (stanza) => { console.log('Stanza:', stanza.root().toString()); }); client.on('error', (err) => { console.error('Error:', err); });
Debug
Known issues
deprecatedThe package is not actively maintained and may not work with newer NativeScript versions.
fix
Consider using a different XMPP library or contribute to maintenance.
affects: >=1.2.0
gotchaOnly WebSocket transport is supported; BOSH or direct TCP are not available.
fix
Ensure your XMPP server has WebSocket support enabled.
affects: *
gotchaThe plugin uses 'tns-core-modules' and may break with NativeScript 7+ due to breaking changes.
fix
Check compatibility or use @nativescript/core instead.
affects: >=1.2.0
gotchaEvent 'online' may not fire if authentication fails; always attach 'error' handler.
fix
Implement comprehensive error handling.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'nativescript-websockets'
Missing peer dependency
fix
Run 'npm install nativescript-websockets --save' or 'tns install nativescript-websockets'.
TypeError: client.on is not a function
Client not properly instantiated or imported incorrectly
fix
Ensure you use 'new Client(...)' and import { Client } correctly.
Error: WebSocket connection to 'ws://...' failed: Connection refused
XMPP server not running or WebSocket endpoint incorrect
fix
Verify server URL and that WebSocket is enabled on the XMPP server.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
tns-core-modulesrequiredNativeScript core modules for platform access
nativescript-websocketsrequiredWebSocket implementation for NativeScript
Agent activity
17 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
nativescript-xmpp-client — npm install nativescript-xmpp-client · libregistry