Export to GitHub

asmack - issue #1

Compression doesn't seem to be supported


Posted on Jan 1, 2010 by Helpful Elephant

I tried to set useCompression to true in ConnectionConfiguration. But when I does my app throws an exception that I need to add smackx.jar to classpath. For mobile use compression is very interesting I think. Si it would be really nice if this gets fixed.

Comment #1

Posted on Jan 5, 2010 by Grumpy Rhino

Hi,

you have to add jzlib for compression, but I didn't get it to work with 3 servers. I'd have to setup a server and test it (to ensure it's not a server problem).

The default jzlib jar works, so just drop it their. I'd add it if I get it to work.

Regards, René

Comment #2

Posted on Nov 29, 2010 by Quick Cat

Hi,

I'm developing an app in witch compression is needed due to network limitations. How do I solve this error. The asmack jar includes de smackx but it does not work. Adding it from the smack also causes trouble. I've also looked to the JZlib but was not able to understand Renés' answer. Can someone help?

Thanks

Comment #3

Posted on Nov 29, 2010 by Quick Cat

Ok, I've finally understood Renés' tip.

Downloaded JZlib source through their site (http://www.jcraft.com/jzlib/), created a new project in eclipse with the source files in the "com.jcraft.jzlib" package, generated the JAR and added it to the referenced libraries in the app that I'm developing.

Regards

Comment #4

Posted on Dec 20, 2010 by Happy Camel
        public void entriesDeleted(Collection<String> entries) {
            for (String entry : entries) {
                debugLog("entriesDeleted(" + entries + "->"
                        + entries.size() + ")");
                RosterEntry rosterEntry = mRoster.getEntry(entry);
                debugLog("entriesDeleted(" + entries + "->"
                         + ")");
                debugLog("entriesDeleted(" + entries + "->"
                        + rosterEntry.getUser() + ")");
                deleteRosterEntryToUI(rosterEntry);
            }
            mServiceCallBack.rosterChanged();
        }

in this funcation ,there mybe a bug , and when i exec in rosEntry.getUser(). this may end, is there any solution for this bug?

Comment #5

Posted on Mar 22, 2011 by Grumpy Rhino

panda: If you want to report a bug, please open a new one. Don't post your stuff somewhere completely unrelated.

I can confirm that adding jzlib to my project actually works, or at least it doesn't cause problems.

Procedure: 1. Download jzlib-1.0.7.zip or .tar.gz from jcraft.com 2. Unpack and cd into the unpacked directory 3. Compile jzlib: $ mkdir class $ javac -d class $(find com -name "*.java") $ cd class $ jar cvf ../jzlib-1.0.7.jar . 4. Move jzlib-1.0.7.jar into your Android project (into lib/ for example) 5. Edit the build path for your project In Eclipse, this is right-click onto the project, then Properties, then Java Build Path (press F5 first so Eclipse sees the .jar) 6. Add the .jar to the build path In Eclipse, this is under Libraries 7. Make sure jzlib-1.0.7.jar gets compiled into the .apk In Eclipse, select the corresponding check box under Order and Export 8. Enable compression, like this for example: ConnectionConfiguration config = new ConnectionConfiguration(server, port); config.setCompressionEnabled(true); Connection connection = new XMPPConnection(config); 9. Rebuild your project

I have not tested if the network traffic is actually compressed, but at least there are no build/runtime errors.

Comment #6

Posted on Mar 23, 2011 by Quick Bear

It seems to be working. Should do some more tests, but if you set config.setSecurityMode(SecurityMode.disabled) and activate the compression, then listening to the tcp stream you should see gibberish instead of plain text.. I suppose this means it is compressed :)

Comment #7

Posted on Jun 2, 2011 by Happy Wombat

This does enable compression, tho i have found an issue with it, when you enable compression you can not .disconnect(). When you try smack freezes waiting for a response from the server. I have not yet found a solution for this. Compression on/off send exact same shazma(or w/e they are called).

Comment #8

Posted on Jul 9, 2012 by Helpful Elephant

Did someone finally find a solution for this issue?.

Comment #9

Posted on Feb 20, 2013 by Swift Rabbit

You will find a version which contains a fix for this issue at the new home of aSmack: https://github.com/flowdalic/asmack

Please make sure to read the provided README or else it may not work!

Status: FixedGithub

Labels:
Type-Defect Priority-Medium