txmpp: A BSD Licensed C++ XMPP Library

txmpp is a permissively licensed (BSD) C++ XMPP library based on libjingle.

The goals for txmpp and why it's a separate project from libjingle are as follows:

  • All code is under a single, unified namespace
  • All code is permissively licensed
  • Good build and install support for POSIX operating systems
  • Focus on core XMPP components (the XEP-0166 related code has been removed)

I've currently got the library building on Fedora 13, CentOS 5 and OS X. In the near future I'm going to focus on removing the Windows code and reducing the amount of code not directly tied to core XMPP functionality.

With all that said I want to keep the core as close to libjingle as possible. I think it's important that txmpp can track and integrate changes from libjingle in a relatively simple way.

If you're interested in messing around with the library I'd recommend checking out the sample code in the examples directory.

node.js HTTPS (SSL) Server Example

A simple HTTPS server using node.js:

const crypto = require('crypto'),
      fs = require("fs"),
      http = require("http");

var privateKey = fs.readFileSync('privatekey.pem').toString();
var certificate = fs.readFileSync('certificate.pem').toString();

var credentials = crypto.createCredentials({key: privateKey, cert: certificate});

var handler = function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
};

var server = http.createServer();
server.setSecure(credentials);
server.addListener("request", handler);
server.listen(8000);

You can generate the privatekey.pem and certificate.pem files using the following commands:

openssl genrsa -out privatekey.pem 1024 
openssl req -new -key privatekey.pem -out certrequest.csr 
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem

Update: Thanks to Kord Campbell for spotting an issue and sending a fix!