It’s just data

XHTML-IM over TLS via Erlang

jabberdemo.erl constructs and sends an XHTML-IM message over TLS using xmerl and Erlang.  Tested with gaim and ejabberd.

The creation of the Session data structure is the bulk of the code.  xmerl:export_simple and ssl:send pretty much take care of all the rest.

A small utility function named export_text exports just the text nodes from an XHTML data structure, which is sent as a fallback to non-XHTML-IM aware clients.  Of course, xmerl supports more patterns, but for the moment, this is enough for my purposes.

Longer term, this needs to be split up into a module which spawns threads and exports separate interfaces for things like authenticating, sending messages to a server, and registering callbacks for presence changes.


Sam Ruby: XHTML-IM over TLS via Erlang

jabberdemo.erl constructs and sends an XHTML-IM message over TLS using xmlerl and Erlang. Tested with gaim and ejabberd....

Excerpt from del.icio.us/tag/erlang at

Thanks for posting this.

Unforunately it just hangs for me, in ssl:connect, but I probably deserve it for attempting to run it under Windows. I’ll have to either stop doing that or try and debug my Erlang->OpenSSL setup.

Posted by Ciaran at

Ciaran: if it helps, my prior version didn’t use ssl.

Posted by Sam Ruby at

Thanks for that suggestion, but I just got it working in secure mode anyway. I was trying to use port 5222, but it seems that a secure connection on 5222 requires TLS handshaking, while 5223 is non-handshaked. I opened up 5223 on the server’s firewall and switched the code back to that and it’s now working nicely.

I was under the impression that using 5223 was a bit non-standard/old-fashioned, but a brief Google around leads me to believe that getting TLS and Erlang to play nicely is not totally straightforward (e.g. here: [link]) , so I will stick with my working setup for now - I’m only experimenting with things at the moment anyway.

Thanks again. Consider it tested with Openfire on the server, and Smack, Pidgin and Jabber.NET (C# library) at the receiving end. All working.

Posted by Ciaran at

By the way (and I don’t know if you find this irritating or not, so I won’t do it again unless you say otherwise).... s/xmlerl/xmerl/ and s/ulitity/utility/

Posted by Ciaran at

s/xmlerl/xmerl/ and s/ulitity/utility/

Fixed.  Thanks!  (does that answer your question? :-))

Posted by Sam Ruby at

Parsing Atom with Erlang

A simple program for parsing memes.atom.  Below is an annotated version. -module(memes). -export([scan/0]). -include_lib("xmerl/include/xmerl.hrl"). Define a module named memes that exports a single function named... [more]

Trackback from Sam Ruby

at

links for 2007-08-29

Top 10 online UNIVERSITIES (tags: web tutorial) XHTML-IM over TLS via Erlang (tags: erlang jabber xml programming)...

Excerpt from Bloggitation at

IPC with Erlang

Previous status: I’ve shown Erlang code that sends a Jabber message.  I’ve shown Erlang code that parses a planet Venus generated Mememes feed.  Now, lets consider the problem of sending notifications for new items. Typically... [more]

Trackback from Sam Ruby

at

Adventures in Jabberlang

For part 3 of this ‘exciting’ series, I’m adding Jabberlang onto the existing setup to provide easy access to two-way XMPP messaging. If I was just sending, I would have restricted myself to tinkering with the code that Sam Ruby...

Excerpt from Ciaran's Random Writings at

[link]...

Excerpt from del.icio.us/vinoski at

Sideways Computing

On many-core, wasted cores, threads, processes, transactional memory, and the E-word....

Excerpt from ongoing at

Yet Another Programming Weblog: Sam Ruby y Erlang

Asisto con una mezcla de envidia y escepticismo a la conversión a Erlang de Sam Ruby . Sam Ruby es un típico goleor tecnológico ™ Siempre está a la última en cuanto a estándares y lenguajes sobre la web. De hecho, algunos los hace él :) Como...

Excerpt from Planeta Código at

Adventures in Jabberlang

For part 3 of this ‘exciting’ series, I’m adding Jabberlang onto the existing setup to provide easy access to two-way XMPP messaging. If I was just sending, I would have restricted myself to tinkering with the code that Sam Ruby...

Excerpt from Ciaran's Random Writings » XMPP at

Add your comment