diyabhat12 / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

Compression doesn't seem to be supported #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by till.klo...@gmail.com on 1 Jan 2010 at 10:37

GoogleCodeExporter commented 8 years ago
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é

Original comment by rtreffer@gmail.com on 5 Jan 2010 at 2:55

GoogleCodeExporter commented 8 years ago
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

Original comment by rodrigo....@beware.pt on 29 Nov 2010 at 2:57

GoogleCodeExporter commented 8 years ago
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

Original comment by rodrigo....@beware.pt on 29 Nov 2010 at 3:46

GoogleCodeExporter commented 8 years ago
            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?

Original comment by panda...@gmail.com on 20 Dec 2010 at 8:50

GoogleCodeExporter commented 8 years ago
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.

Original comment by onit...@gmail.com on 22 Mar 2011 at 4:42

GoogleCodeExporter commented 8 years ago
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 :)

Original comment by fusion...@gmail.com on 23 Mar 2011 at 8:38

GoogleCodeExporter commented 8 years ago
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).

Original comment by Jug6ern...@gmail.com on 2 Jun 2011 at 5:19

GoogleCodeExporter commented 8 years ago
Did someone finally find a solution for this issue?.

Original comment by morales....@gmail.com on 9 Jul 2012 at 12:36

GoogleCodeExporter commented 8 years ago
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!

Original comment by fschm...@gmail.com on 20 Feb 2013 at 4:42