powered by Jive Software

Is there an HOWTO for PacketExtensionProvider?

I need to built an PacketExtionsion and tried to learn from the documentation. But I didn’t found any documention how to create my custom PacketExtension or how a PacketExtensionProvider works. I tried to learn from the existing XHTML Extension, but didn’t understand anything. Is there a howto or something, which would help me?

I want to send SVG-data via Jabber, but thinks this is to complex and didn’t found an extension for that. So I want to write my own primitive extension.



I don’t have any experience with packet extension providers, but there are a couple other things you can use to achieve a similar result. This is a stripped down example of 2 methods for adding and extracting some extension data using a chat message:

// This is used to add custom extension data before sending a packet

private void addCustomExt(Message message) {

DefaultPacketExtension extension = new DefaultPacketExtension(“custom”,


extension.setValue(“key”, “value”);



// This is used to extract custom extension data after receiving a packet

private String getCustomExt(Message message) {

DefaultPacketExtension extension = (DefaultPacketExtension) message

.getExtension(“custom”, “jabber:x:custom”);

if (extension != null) {

return extension.getValue(“key”);


return null;


Another option is to use the property system built-in to Smack, which you can find documentation about here:

http://www.igniterealtime.org/builds/smack/docs/latest/documentation/properties. html

Hope this helps,


Hi Keywan,

You can take a look at how we used packet extensions on our Shared Editor and Whiteboard sparkplugs.



Oh damn. This looks great. I will check it out, when I am back on a x86-PC. Do you know, that I work on an whiteboard extension for jabber, but for JBother and not for Spark? I will dig into your code

Hi, i’m trying to use this code and i have the exception:

Cannot cast from PacketExtension to DefaultPacketExtension.

How can i resolve this?

Thank you