<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>El Tramo | XMPP</title>
  <subtitle>Remko Tronçon's Homepage</subtitle>
  <link href="http://el-tramo.be/blog/tag/xmpp/feed/" rel="self" type="application/rss+xml"/>
  <link href="http://el-tramo.be/"/>
  <updated>2011-12-30T17:00:29+01:00</updated>
  <id>http://el-tramo.be/</id>
  <author>
    <name>Remko Tronçon</name>
    <uri>http://el-tramo.be/about/</uri>
  </author>
  
  <entry>
    <title>Experimental File Transfer support hits Swift </title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swift-experimental-ft"/>
    <updated>2011-09-25T00:00:00+02:00</updated>
    <id>http://el-tramo.be/blog/swift-experimental-ft</id>
    <content type="html">It's been a busy summer for &lt;a href=&quot;http://ayena.de&quot;&gt;Tobias Markmann&lt;/a&gt;, one of the &lt;a href=&quot;http://xmpp.org/2011/04/xsf-welcomes-google-summer-of-code-2011-students/&quot;&gt;XMPP Standards Foundation’s 2011 Google Summer of Code students&lt;/a&gt;. He has been working on implementing File Transfer support for &lt;a href=&quot;http://swift.im&quot;&gt;Swift&lt;/a&gt;, using the fresh Jingle XMPP protocols. I'm happy to announce that we integrated &lt;a href=&quot;http://swift.im/git/swift/commit/?id=4f62e5ec4b42929fe3c1a68667e63cb1b7a35509&quot;&gt;Tobias’s work&lt;/a&gt; as an experimental feature into the main Swift branch, where it will be further developed and brushed off before being enabled in our nightly builds and releases.

&lt;!--more--&gt;

For those interested in the nitty gritty protocol details: file transfers are negotiated through the Jingle File Transfer protocol (&lt;a href=&quot;http://xmpp.org/extensions/xep-0234.html&quot;&gt;XEP-0234&lt;/a&gt;), using SOCKS5 (&lt;a href=&quot;http://xmpp.org/extensions/xep-0260.html&quot;&gt;XEP-0260&lt;/a&gt;) as the main transport, and In-Band Bytestreams (&lt;a href=&quot;http://xmpp.org/extensions/xep-0261.html&quot;&gt;XEP-0261&lt;/a&gt;) as fallback. To improve connectivity, we use both the &lt;a href=&quot;http://files.dns-sd.org/draft-cheshire-nat-pmp.txt&quot;&gt;NAT Port Mapping Protocol&lt;/a&gt; and the &lt;a href=&quot;http://www.upnp.org/&quot;&gt;UPnP Internet Gateway Device protocols&lt;/a&gt; to allow connections through most firewalls, and &lt;a href=&quot;http://xmpp.org/extensions/xep-0065.html#mediated&quot;&gt;SOCKS5 relaying proxies&lt;/a&gt; in case all else fails.  

The new feature has been tested for interoperability against (slightly modified) development versions of both &lt;a href=&quot;http://pidgin.im&quot;&gt;Pidgin&lt;/a&gt; and &lt;a href=&quot;http://gajim.org&quot;&gt;Gajim&lt;/a&gt;, which, together with the Pidgin-based &lt;a href=&quot;http://adium.im&quot;&gt;Adium&lt;/a&gt;, cover a large XMPP user base. After both clients update their protocols to track the newly published Draft specification versions, all 3 should be able to exchange files seamlessly.

What still remains to be done is lots of testing (both internal testing, user testing, reliability testing, and interop testing), bugfixing, and some refactoring here and there to clean up some of the code (which already is in very good shape). Our end goal is to reach a rock solid implementation, with a near guarantee that file exchange will always work (which experience teaches us is far from trivial).

To conclude, we’ld like to thank Tobias for contributing this great new feature to Swift, for providing valuable protocol feedback to the XSF, and for laying the foundation to other exciting Jingle-based features (including voice/video conferencing).
</content>
  </entry>
  
  <entry>
    <title>Summer of Swift Code 2011</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swift-gsoc-2011"/>
    <updated>2011-04-26T00:00:00+02:00</updated>
    <id>http://el-tramo.be/blog/swift-gsoc-2011</id>
    <content type="html">Yesterday, Google &lt;a href=&quot;http://google-opensource.blogspot.com/2011/04/students-announced-for-2011-google.html&quot;&gt;announced&lt;/a&gt; the 1116 students that were accepted for this year's edition of the Google Summer of Code, &lt;a href=&quot;http://xmpp.org/2011/04/xsf-welcomes-google-summer-of-code-2011-students/&quot;&gt;5&lt;/a&gt; of which will be working with the XMPP Standards Foundation. We're very happy to welcome both  Tobias Markmann and Vlad Voicu, who will be working full-time on Swift this summer, implementing file transfer support and conversation history respectively.

We have to mention that these weren't the only proposals we received. Most of the proposals we received this year were of good quality: we suspect that the teaser tasks we put up for potential students made it possible for both the students and us to get an idea up front of what should be expected. However, based on experience from previous years, we decided we should only accept 2 students, to ensure that we could give our full attention to making all projects successful (including fast integration into a Swift release). We're convinced that both Vlad and Tobias will live up to their expectations, and implement some of the most requested Swift features today!
</content>
  </entry>
  
  <entry>
    <title>Swift 1.0 Released</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swift-1-0"/>
    <updated>2011-04-18T00:00:00+02:00</updated>
    <id>http://el-tramo.be/blog/swift-1-0</id>
    <content type="html">Finally! After 2 years of development, we're happy to finally announce the &lt;a href=&quot;http://swift.im/releases/swift-1.0&quot;&gt;first full release&lt;/a&gt; of the Swift IM client! In this first release, we have focused on building a user-friendly messaging client, with all the basic features you would typically need for having real-time conversations. In future versions (which are already in the works as we speak), we will be extending Swift with more features.

We would like to thank &lt;a href=&quot;http://isode.com&quot;&gt;Isode&lt;/a&gt; for sponsoring time for Kevin to work on Swift, &lt;a href=&quot;http://flosoft.biz&quot;&gt;Flosoft&lt;/a&gt; for providing our download infrastructure, Dave Cridland for the logo, all the translators who helped us make Swift available in different languages, all the code contributors, all of whom should be listed on our &lt;a href=&quot;http://swift.im/about/&quot;&gt;About page&lt;/a&gt;, and all our beta testers for giving us feedback and bugreports throughout the whole development period!
</content>
  </entry>
  
  <entry>
    <title>Swift Translators Wanted</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swift-translators-wanted"/>
    <updated>2011-03-22T00:00:00+01:00</updated>
    <id>http://el-tramo.be/blog/swift-translators-wanted</id>
    <content type="html">Now that &lt;a href=&quot;http://swift.im/releases/swift-1.0beta9&quot;&gt;the final Swift beta&lt;/a&gt; has been released, it's time to start translating Swift in as many languages as possible! Thanks to a handful of early translators, we've been able to iron out (hopefully) the last translation issues from beta9, and we have Dutch, Polish, French, German, Norwegian, Czech, Slovak, Spanish, and Catalan translations in the works. So, now, we're calling out to you: if your language is not in the list, and you feel you could do a good job translating the Swift user interface (containing about 250 strings), please drop by the Swift room &lt;code&gt;swift@rooms.swift.im&lt;/code&gt;, and let us know!
</content>
  </entry>
  
  <entry>
    <title>XMPP Scripting with Sluift</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/sluift"/>
    <updated>2011-03-05T00:00:00+01:00</updated>
    <id>http://el-tramo.be/blog/sluift</id>
    <content type="html">Did you ever want to find out what XMPP clients people in your contact list are using? Do you want to migrate your contact list from one server to another, but don’t want to provide your password to some on-line service to do that? Do you have some XMPP-related task you quickly want to write a script for, but don’t want to deal with complex asynchronous APIs? Well, &lt;em&gt;Sluift&lt;/em&gt; may be just the thing you are looking for! 

Sluift is a &lt;a href=&quot;http://lua.org&quot;&gt;Lua&lt;/a&gt;-based script layer on top of the &lt;a href=&quot;http://swift.im/swiften&quot;&gt;Swiften&lt;/a&gt; XMPP library. It provides a simple API to do common XMPP tasks, either interactively (through an XMPP console), or by running a script in batch mode. In this post, we’ll go through some examples of what you can already do with Sluift today.

&lt;!--more--&gt;

Let’s start with a very simple task: logging into a server, and sending a message to one of our contacts. We fire up Sluift, and start by typing the commands to log in:
&lt;pre&gt;== Sluift XMPP Console (20110304) == 
Press Ctrl-D to exit  
&gt; &lt;b&gt;c = sluift.new_client(&quot;alice@wonderland.lit&quot;, &quot;MySecret&quot;)&lt;/b&gt;
&gt; &lt;b&gt;c:connect()&lt;/b&gt;
&gt;&lt;/pre&gt;
Now that we're connected to the server, let's send out presence (so people can see we’re online), and send the message to one of our contacts:
&lt;pre&gt;&gt; &lt;b&gt;c:send_presence(&quot;I'm here&quot;)&lt;/b&gt;
&gt; &lt;b&gt;c:send_message(&quot;sister@realworld.lit&quot;, &quot;Hi there!&quot;)&lt;/b&gt;&lt;/pre&gt;
Now, let's wait 3 seconds for her reply, by printing out all the incoming events, and finish off by disconnecting:
&lt;pre&gt;&gt; &lt;b&gt;c:for_event(function(e) tprint(e) end, 3000)&lt;/b&gt;
([type] =&gt; presence, [from] =&gt; sister@realworld.lit/Home, 
 [status] =&gt; At home)
([type] =&gt; presence, [from] =&gt; rabbit@wonderland.lit/Party, 
 [status] =&gt; Tea party!)
([type] =&gt; message, [from] =&gt; sister@realworld.lit/Home, 
 [body] =&gt; Hi Alice!)
&gt; &lt;b&gt;c:disconnect()&lt;/b&gt;
&gt;&lt;/pre&gt;

Now for a slightly more complex example. Suppose that you want to switch XMPP servers, but you want to take all your contacts with you to your new account. To do this, you start by logging into your current account, and fetch your contact list:
&lt;pre&gt;&gt; &lt;b&gt;c = sluift.new_client(&quot;alice@wonderland.lit&quot;, &quot;MySecret&quot;)&lt;/b&gt;
&gt; &lt;b&gt;c:connect()&lt;/b&gt;
&gt; &lt;b&gt;contacts = c:get_contacts()&lt;/b&gt;
&gt; &lt;b&gt;tprint(contacts)&lt;/b&gt;
[sister@wonderland.lit] =&gt; table
    ( [jid] =&gt; sister@wonderland.lit
      [subscription] =&gt; both
      [groups] =&gt; table ( [1] =&gt; Family )
      [name] =&gt; Sister )
...
&lt;/pre&gt;
Now that we have our contact list, let’s disconnect, log into our second account, and add all the contacts from the list to the second account:
&lt;pre&gt;&gt; &lt;b&gt;c:disconnect()&lt;/b&gt;
&gt; &lt;b&gt;c = sluift.new_client(&quot;alice@teaparty.lit&quot;, &quot;MyOtherSecret&quot;)&lt;/b&gt;
&gt; &lt;b&gt;c:connect()&lt;/b&gt;
&gt; &lt;b&gt;for _, contact in pairs(contacts) do c:add_contact(contact) end&lt;/b&gt;
&lt;/pre&gt;
That’s it, all your contacts have now been migrated! 

So far, we have used Sluift as an interactive XMPP console. However, Sluift’s synchronous/blocking nature (it only executes the next command when you have the results of the previous) also makes it very suitable for writing small batch scripts. For example, you can write a short script to collect statistics about which sever software is popular amongst your contacts:
&lt;pre&gt;c = sluift.new_client(&quot;alice@wonderland.lit&quot;, &quot;MySecret&quot;)
c:connect()
versions = {}
for jid, _ in pairs(c:get_contacts()) do
  v = c:get_version(sluift.jid_domain(jid))
  if v then versions[v[&quot;name&quot;]] = (versions[v[&quot;name&quot;]] or 0) + 1 end
end
for name, cnt in pairs(versions) do print(name .. &quot;: &quot; .. cnt) end
c:disconnect()&lt;/pre&gt;
Executing the script gives us the following result:
&lt;pre&gt;$ ./sluift CollectVersions.lua
jabberd2: 1
Prosody: 25
Isode M-Link: 31
yabberd: 1
SoapBox Server 2007: 1
jabberd: 5
Tigase: 2
ejabberd: 19
Openfire: 4&lt;/pre&gt;

And finally, we can’t show script examples without including our beloved &lt;a href=&quot;https://github.com/remko/xmpp-tdg/tree/master/code/EchoBot&quot;&gt;EchoBot&lt;/a&gt; from &lt;a href=&quot;http://oreilly.com/catalog/9780596521271&quot;&gt;XMPP: The Definitive Guide&lt;/a&gt;:
&lt;pre&gt;c = sluift.new_client(&quot;echobot@wonderland.lit&quot;, &quot;mypass&quot;)
c:connect():send_presence(&quot;Send me a message&quot;)
c:for_event(function(e)
    if e[&quot;type&quot;] == &quot;message&quot; then 
      c:send_message(e[&quot;from&quot;], e[&quot;body&quot;])
    end
  end)&lt;/pre&gt;
&lt;/pre&gt;

Besides interactive and scripted tasks, another great use for Sluift is for XMPP testing (which is the reason we started Sluift in the first place). However, we will go into details about this use case in a later blog post. For now, if you want to play around with Sluift yourself, you can build a development version from the &lt;a href=&quot;http://swift.im/git/swift&quot;&gt;Swift Git repository&lt;/a&gt; (together with some &lt;a href=&quot;http://swift.im/git/swift/tree/Sluift/Examples&quot;&gt;examples&lt;/a&gt;), or you can get a snapshot for Windows or Mac OS X &lt;a href=&quot;http://swift.im/sluift/&quot;&gt;here&lt;/a&gt; (currently only works on very specific setups).

Finally, note that, although you can already do quite some tasks with Sluift today, the API is still quite limited (and undocumented). We are adding new functionality to Sluift as we need it or as people ask for it, so if you’re interested in Sluift, speak up!

Stay tuned for more on the topic of XMPP scripting!
</content>
  </entry>
  
  <entry>
    <title>Swiften on Lambdas</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swiften-lambdas"/>
    <updated>2011-02-04T00:00:00+01:00</updated>
    <id>http://el-tramo.be/blog/swiften-lambdas</id>
    <content type="html">One of the cool new features of the upcoming C++ (0x) standard is support for
&lt;a
href=&quot;http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions&quot;&gt;lambda
expressions&lt;/a&gt;, providing functional-style inline function declarations. After
seeing &lt;a href=&quot;http://herbsutter.com/&quot;&gt;Herb Sutter&lt;/a&gt;’s &lt;a
href=&quot;http://blogs.msdn.com/b/vcblog/archive/2011/02/01/10123374.aspx&quot;&gt;PDC 2010
webcast on lambdas&lt;/a&gt;, I wanted to try this out on Swiften, the XMPP library
behind &lt;a href=&quot;http://swift.im&quot;&gt;Swift&lt;/a&gt;. I adapted the introductory &lt;a
href=&quot;https://github.com/remko/xmpp-tdg/tree/master/code/EchoBot&quot;&gt;EchoBot
example&lt;/a&gt; from &lt;a href=&quot;http://oreilly.com/catalog/9780596521271&quot;&gt;XMPP: The
Definitive Guide&lt;/a&gt;, and ported it from Python to a C++ application using
Swiften. The result is surprisingly clean.

&lt;!--more--&gt;

The purpose of EchoBot is simple: connect to an XMPP server, log in, send out a
status message to announce you're available, and then wait and respond to all
incoming messages with the exact same message. Translating this into C++ code,
with lambdas, gives us the following: 

<div class="highlight"><pre><code class="c"><span class="cp">#include &amp;lt;Swiften/Swiften.h&amp;gt;</span>

<span class="n">using</span> <span class="n">namespace</span> <span class="n">Swift</span><span class="p">;</span>

<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span><span class="p">)</span> <span class="p">{</span>
	<span class="c1">// Set up the event loop and network classes</span>
	<span class="n">SimpleEventLoop</span> <span class="n">eventLoop</span><span class="p">;</span>
	<span class="n">BoostNetworkFactories</span> <span class="n">networkFactories</span><span class="p">(</span><span class="o">&amp;</span><span class="n">amp</span><span class="p">;</span><span class="n">eventLoop</span><span class="p">);</span>

	<span class="c1">// Initialize the client with the JID and password</span>
	<span class="n">Client</span> <span class="n">client</span><span class="p">(</span>
		<span class="o">&amp;</span><span class="n">quot</span><span class="p">;</span><span class="n">echobot</span><span class="err">@</span><span class="n">wonderland</span><span class="p">.</span><span class="n">lit</span><span class="o">&amp;</span><span class="n">quot</span><span class="p">;,</span> <span class="o">&amp;</span><span class="n">quot</span><span class="p">;</span><span class="n">mypass</span><span class="o">&amp;</span><span class="n">quot</span><span class="p">;,</span> <span class="o">&amp;</span><span class="n">amp</span><span class="p">;</span><span class="n">networkFactories</span><span class="p">);</span>

	<span class="c1">// When the client is connected, send out initial presence</span>
	<span class="n">client</span><span class="p">.</span><span class="n">onConnected</span><span class="p">.</span><span class="n">connect</span><span class="p">([</span><span class="o">&amp;</span><span class="n">amp</span><span class="p">;]</span> <span class="p">{</span>
		<span class="n">client</span><span class="p">.</span><span class="n">sendPresence</span><span class="p">(</span><span class="n">Presence</span><span class="o">::</span><span class="n">create</span><span class="p">(</span><span class="o">&amp;</span><span class="n">quot</span><span class="p">;</span><span class="n">Send</span> <span class="n">me</span> <span class="n">a</span> <span class="n">message</span><span class="o">&amp;</span><span class="n">quot</span><span class="p">;));</span>
	<span class="p">});</span>

	<span class="c1">// When the client receives an incoming message, echo it back</span>
	<span class="n">client</span><span class="p">.</span><span class="n">onMessageReceived</span><span class="p">.</span><span class="n">connect</span><span class="p">([</span><span class="o">&amp;</span><span class="n">amp</span><span class="p">;]</span> <span class="p">(</span><span class="n">Message</span><span class="o">::</span><span class="n">ref</span> <span class="n">message</span><span class="p">)</span> <span class="p">{</span>
		<span class="n">message</span><span class="o">-&amp;</span><span class="n">gt</span><span class="p">;</span><span class="n">setTo</span><span class="p">(</span><span class="n">message</span><span class="o">-&amp;</span><span class="n">gt</span><span class="p">;</span><span class="n">getFrom</span><span class="p">());</span>
		<span class="n">message</span><span class="o">-&amp;</span><span class="n">gt</span><span class="p">;</span><span class="n">setFrom</span><span class="p">(</span><span class="n">JID</span><span class="p">());</span>
		<span class="n">client</span><span class="p">.</span><span class="n">sendMessage</span><span class="p">(</span><span class="n">message</span><span class="p">);</span>
	<span class="p">});</span>

	<span class="c1">// Start the client</span>
	<span class="n">client</span><span class="p">.</span><span class="n">connect</span><span class="p">();</span>

	<span class="c1">// Run the event loop to start processing incoming network events</span>
	<span class="n">eventLoop</span><span class="p">.</span><span class="n">run</span><span class="p">();</span>
	<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</code></pre>
</div>


The flow of the code follows the description of the bot quite closely. Before
connecting  the client to the network, we declare the actions to be taken on
different events: when connected, send out presence, and when a message was
received, send it back. Swiften uses signals to notify events, and instead of
having to declare slot methods and using &lt;code&gt;boost::bind&lt;/code&gt; to connect
signals to slots, we can now use lambdas to directly specify what should
happen. (for the curious: &lt;code&gt;[&amp;amp;]&lt;/code&gt; means that all variables outside
of the lambda, i.e. &lt;code&gt;client&lt;/code&gt;, are passed by reference) 

The great thing about this is that this works out of the box with recent
compilers: I tried this code with Microsoft Visual Studio 2010 and GCC 4.5.0.
(unfortunately, CLang doesn’t support this feature yet)

If you want to try building your own XMPP applications using Swiften (with or
without C++0x), grab a development version from &lt;a
href=&quot;http://gitorious.com/swift&quot;&gt;the Git repository&lt;/a&gt;, and consult the &lt;a
href=&quot;http://swift.im/swiften/guide&quot;&gt;Swiften Developers Guide&lt;/a&gt; and &lt;a
href=&quot;http://swift.im/swiften/api&quot;&gt;Swiften API documentation&lt;/a&gt; to get
started.
</content>
  </entry>
  
  <entry>
    <title>More squishy data</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/more-squishy-data"/>
    <updated>2010-12-19T00:00:00+01:00</updated>
    <id>http://el-tramo.be/blog/more-squishy-data</id>
    <content type="html">After &lt;a href=&quot;http://ayena.de&quot;&gt;Tobias Markmann&lt;/a&gt; told me that he was running into resource limitations with a Swiften-based tool for testing server load, I decided to do a small experiment myself. I created a &lt;a href=&quot;http://gitorious.org/swift/swift/blobs/master/Swiften/Examples/BenchTool/BenchTool.cpp&quot;&gt;small benchmarking tool&lt;/a&gt;, and ran it through the memory allocation profiler from Apple’s Instruments. It turned out that the combination of TLS and ZLib compression (aka “&lt;a href=&quot;http://blog.dave.cridland.net/?p=73&quot;&gt;squishy data&lt;/a&gt;”) was causing a much higher memory usage than I would have expected. 

&lt;!--more--&gt;

The &lt;a href=&quot;http://gitorious.org/swift/swift/blobs/master/Swiften/Examples/BenchTool/BenchTool.cpp&quot;&gt;benchmark tool&lt;/a&gt; is simple: it creates 100 instances of Swiften’s &lt;code&gt;CoreClient&lt;/code&gt; class (which handles connecting and authenticating with the server), and connects them all simultaneously. Running this through Instruments reports about &lt;strong&gt;97 Mb&lt;/strong&gt; of live data after the stream initialization process (i.e. encryption, compression, authentication). Since 1 Mb per client object is a bit on the high side, it seems worthwile to dig through the call stack a bit, to see who is hogging all the memory:

&lt;a href=&quot;http://el-tramo.be/wordpress/wp-content/uploads/2010/12/swiften-alloc.png&quot;&gt;&lt;img src=&quot;http://el-tramo.be/wordpress/wp-content/uploads/2010/12/swiften-alloc.png&quot; alt=&quot;&quot; title=&quot;Live allocated memory after Swiften stream initialization&quot; width=&quot;559&quot; height=&quot;912&quot; class=&quot;aligncenter size-full wp-image-794&quot; /&gt;&lt;/a&gt;

ZLib compression seems to be allocating quite a lot of memory in 3 places: twice in OpenSSL (for the &lt;a href=&quot;http://blog.dave.cridland.net/?p=73&quot;&gt;built-in TLS compression&lt;/a&gt;), and once in Swiften itself (for &lt;a href=&quot;http://xmpp.org/extensions/xep-0138.html&quot;&gt;XMPP stream compression&lt;/a&gt;). OpenSSL calling &lt;code&gt;deflateInit&lt;/code&gt; twice sounds like a bug, although I haven’t verified whether this has been fixed recently (I’m using OpenSSL 0.9.8l, which comes bundled with Mac OS X). Another problem is that the XMPP server my benchmark was connecting to offered ZLib XMPP stream compression, even though the TLS layer was already compressing my traffic (which is a SHOULD NOT in &lt;a href=&quot;http://xmpp.org/extensions/xep-0138.html&quot;&gt;XEP-0138&lt;/a&gt;). As a workaround for both problems, I disabled compression in the OpenSSL layer:
&lt;pre&gt;STACK_OF(SSL_COMP)* cm = SSL_COMP_get_compression_methods();    
sk_SSL_COMP_zero(cm)&lt;/pre&gt;
After this change, my benchmark ‘only’ has &lt;strong&gt;42 Mb&lt;/strong&gt; of live data after connecting 100 clients with TLS and ZLib stream compression. The 26 Mb of allocated memory in the &lt;code&gt;deflateInit&lt;/code&gt; can probably be reduced by a tweaked &lt;code&gt;deflateInit2&lt;/code&gt; call, but I didn’t invest any effort in this.

Some final numbers for those who are interested: the same benchmark takes &lt;strong&gt;12 Mb&lt;/strong&gt; when disabling compression altogether and using only TLS when connecting, and uses only &lt;strong&gt;4.5 Mb&lt;/strong&gt; when disabling both TLS and ZLib compression. From the remaining 4.5 Mb, LibXML uses the biggest chunk of memory (about 1.5 Mb, roughly the same for Expat), and there is still a bit of room for bringing the rest of the memory usage down (by sharing the element parser &amp; serializer factories across client instances, by lowering the network connection data buffers, ...).
</content>
  </entry>
  
  <entry>
    <title>“Swiften Developer’s Guide” available</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swiften-guide"/>
    <updated>2010-12-04T00:00:00+01:00</updated>
    <id>http://el-tramo.be/blog/swiften-guide</id>
    <content type="html">People have recently been showing interest in using Swiften, &lt;a href=&quot;http://swift.im&quot;&gt;Swift&lt;/a&gt;’s C++ XMPP library, for building their own XMPP applications. We therefore created the &lt;a href=&quot;http://swift.im/swiften/guide&quot;&gt;Swiften Developer’s Guide&lt;/a&gt; with a tutorial-style guide to Swiften (including &lt;a href=&quot;http://gitorious.com/swift/swift/trees/master/Documentation/SwiftenDevelopersGuide/Examples/EchoBot&quot;&gt;examples&lt;/a&gt;), and made it available together with the &lt;a href=&quot;http://swift.im/swiften/api&quot;&gt;Swiften API Documentation&lt;/a&gt;. If you’re interested in creating an XMPP client or component, be sure to give these documents (and some of the &lt;a href=&quot;http://gitorious.org/swift/swift/trees/master/Swiften/Examples&quot;&gt;examples&lt;/a&gt; from the Swift code repository) a look!
</content>
  </entry>
  
  <entry>
    <title>Swift 1.0-beta8 released</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swift-1-0beta8"/>
    <updated>2010-11-03T00:00:00+01:00</updated>
    <id>http://el-tramo.be/blog/swift-1-0beta8</id>
    <content type="html">We just released the next Swift beta, &lt;a href=&quot;http://swift.im/releases/swift-1.0beta8/&quot;&gt;beta8&lt;/a&gt;. The major focus of this release was fix some crashes, problems, and papercuts from the previous beta(s). For a full list of changes, see the &lt;a href=&quot;http://swift.im/releases/swift-1.0beta8/&quot;&gt;Swift 1.0beta8 release page&lt;/a&gt;. The list of outstanding cases is getting shorter and shorter, so this will hopefully be one of the last few betas before 1.0. This also means now is the perfect time to give Swift a shot, and give us your feedback!
</content>
  </entry>
  
  <entry>
    <title>Swift 1.0-beta6 released</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/swift-1-0beta6"/>
    <updated>2010-08-23T00:00:00+02:00</updated>
    <id>http://el-tramo.be/blog/swift-1-0beta6</id>
    <content type="html">It's been a while since we released the previous Swift beta. As a result, the sixth beta is quite packed with bugfixes, speedups, and general improvements. The list of changes is too long to describe here, so head on over to &lt;a href=&quot;http://swift.im/releases/swift-1.0beta6/&quot;&gt;http://swift.im/releases/swift-1.0beta6/&lt;/a&gt; for details and downloads of the last Swift beta, and let us know what you think in the MUC room – &lt;a href=&quot;xmpp:swift@rooms.swift.im?join&quot;&gt;swift@rooms.swift.im&lt;/a&gt;.
</content>
  </entry>
  
</feed>

