Skip to content

XMPP library for React Native (using iOS XMPPFramework library), alpha release (base messaging is supported at this moment)

License

Notifications You must be signed in to change notification settings

vaxxis/react-native-xmpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-xmpp

XMPP library for React Native

Simple interface for native XMPP communication (only iOS supported at this moment) using iOS XMPPFramework

Demo

XmppDemo uses Flux approach (check its XmppStore) to communicate with sample XMPP server, where 4 accounts were registered. demo-3

Example

var XMPP = require('react-native-xmpp');

// optional callbacks
XMPP.on('message', (message)=>console.log("MESSAGE:"+JSON.stringify(message)));
XMPP.on('iq', (message)=>console.log("IQ:"+JSON.stringify(message)));
XMPP.on('presence', (message)=>console.log("PRESENCE:"+JSON.stringify(message)));
XMPP.on('error', (message)=>console.log("ERROR:"+message));
XMPP.on('loginError', (message)=>console.log("LOGIN ERROR:"+message));
XMPP.on('login', (message)=>console.log("LOGGED!"));
XMPP.on('connect', (message)=>console.log("CONNECTED!"));
XMPP.on('disconnect', (message)=>console.log("DISCONNECTED!"));

// connect
XMPP.connect(MYJID, MYPASSWORD);

// send message
XMPP.message('Hello world!', TOJID);

// join room
XMPP.joinRoom('ROMJID', 'nickname');

// send room's message
XMPP.sendRoomMessage('Hello world!!!');

// disconnect
XMPP.disconnect();

Getting started

  1. npm install react-native-xmpp --save
  2. cd node_modules/react-native-xmpp
  3. pod install --no-integrate
  4. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  5. add ./node_modules/react-native-xmpp/RNXMPP.xcodeproj
  6. In the XCode project navigator, select your project, select the Build Phases tab and in the Link Binary With Libraries section add libRNXMPP.a, *libresolv and libxml2

About

XMPP library for React Native (using iOS XMPPFramework library), alpha release (base messaging is supported at this moment)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 64.9%
  • JavaScript 34.1%
  • Other 1.0%