🗯️
Chat SDK
  • Chat SDK Docs
  • Guides
    • Android Docs
    • iOS Docs
    • API Cheat Sheet
    • Best Practices and Troubleshooting
    • Custom Token Authentication
    • Firebase Schema
    • Custom File Upload Handler
  • Commercial
    • Module Licensing
    • Consulting Charges
    • Scalability and Cost
    • Firebase vs. Firestream vs. XMPP
    • Licensing FAQ
    • Adding Modules from source
  • XMPP
    • XMPP Setup Guide
  • About Us
    • History of Chat SDK
  • Architecture
    • Backend Agnostic Architecture
  • Modules
    • Sticker Message Module
Powered by GitBook
On this page
  • Documentation
  • Server setup
  • Client setup
  • Support

Was this helpful?

  1. XMPP

XMPP Setup Guide

PreviousAdding Modules from sourceNextHistory of Chat SDK

Last updated 4 years ago

Was this helpful?

The XMPP Chat SDK is a module that enables XMPP chat for the popular Chat SDK for iOS Messaging Framework.

The Chat SDK provides:

  • User interface

  • Data persistence

The XMPP module then provides a network adapter that allows the Chat SDK UI to communicate with an XMPP server.

Documentation

Since the XMPP project uses the standard Chat SDK UI, there is a lot of documentation available on the Github project pages:

Server setup

The XMPP Chat SDK supports currently supports ejabberd and OpenFire. It may also support other XMPP servers but they have not been tested.

ejabberd

First got to the ejabberd website and download the .

Follow the instructions on the ejabberd site to install ejabberd on your server.

Once the server is setup, you need to change some settings:

Enable registration

Change the ejabberd configuration conf/ejabberd.yml

trusted_network:
    allow: all

local: 
    all: allow

mod_vcard: 
    search: true
    matches: 10
    allow_return_all: true

Start ejabberd by going to the installation directory on your server and running:

sudo sh bin/ejabberdctl start

You can check that ejabberd is up and running by logging in to the server admin:

http://your-server.com:5280/admin

OpenFire

Once you've done that, go into the admin panel and enable in-band registration.

Then enable the search plugin.

Prosody

Make sure you have the following modules enabled:

  1. lastactivity

  2. disco

  3. muc

  4. vcard

  5. blocklist

  6. carbons

  7. time

  8. smacks

Client setup

The XMPP Chat SDK zip file contains everything you need to compile and run the project. However, a few steps are needed before you can compile the project.

iOS Setup

Use the terminal to navigate to the XcodeXMPPSwift folder. Then run pod update. This will install the project using Cocoapods.

Now open your app delegate and add the following code to setup the Chat SDK:

let config = BConfiguration.init();
config.googleMapsApiKey = "Google Maps Key"
config.loginUsernamePlaceholder = "JID"

// Set to true for non-https connections
config.xmppUseHTTP = true
config.logoImage = UIImage(named: "logo")
config.clientPushEnabled = true

// Set the domain and host address of the server
config.xmpp(withDomain: "domain", hostAddress: "host", port: 5222, resource: "iphone")

BChatSDK.initialize(config, app: application, options: launchOptions)

Android Setup

In your main application class setup the Chat SDK then configure the XMPP server:

ChatSDK.builder()

        // Configure the library
        .setGoogleMaps("Your Google Maps Key")
        .setAnonymousLoginEnabled(false)
        .setDebugModeEnabled(false)
        .build()

        // Add modules to handle file uploads, push notifications
        .addModule(FirebaseUploadModule.shared())
        .addModule(FirebasePushModule.shared())

        .addModule(XMPPModule.builder()
                .setXMPP("host", "domain")
                .setAllowServerConfiguration(false)
                .setPingInterval(5).build())
        .addModule(UIModule.builder()
                .setMessageSelectionEnabled(false)
                .setUsernameHint("JID")
                .setResetPasswordEnabled(false)
                .build())
        .addModule(LocationMessageModule.shared())

        .build().activate(this, "your-email-address");

Update the Android SDK and NDK locations in local.properties

ndk.dir=/Users/Shared/Projects2/Libs/NDK
sdk.dir=/Users/Ben3/Library/Android/sdk

Then run the app-xmpp target.

Google Maps

iOS

config.googleMapsApiKey = "Google Maps Key"

Push Notifications

By default, push notifications are handled by Firebase Cloud Messaging. For this to work, you will need to create a Firebase account, link the project to your Firebase account and then perform some configuration steps.

iOS

Android

Then

File Upload

Support

Install on your server or use a pre-installed OpenFire hosting service like the one offered by .

Follow the instructions .

Go to and follow steps 1 - 7.

Go to and follow steps: 1 - 7.

Go to and follow steps 1 - 21.

By default, the project uses Firebase Cloud Storage to store uploaded files. To do this follow the steps under Deploy the storage rules - .

Discord: If you need support, join our

Email:

Android Github Project Page
iOS Github Project Page
API Docs
iOS Wiki
Setup for File transfer and push notifications
Community Version
OpenFire
1and1
here
this link
this link
this link
here
Server
team@sdk.chat