ofxLibwebsockets icon indicating copy to clipboard operation
ofxLibwebsockets copied to clipboard

How to use OfxLibwebsockets for android?

Open sandeep-india opened this issue 11 years ago • 10 comments

Hey guys how can OfxLibwebsockets be used on android with in openFrameworks built through NDK?

sandeep-india avatar Aug 11 '14 06:08 sandeep-india

Hello! It's definitely possible, but you'll have to compile libwebsockets for Android and include that.

It'd be amazing if you could submit a pull request if you're able to get that up and running!

robotconscience avatar Aug 11 '14 14:08 robotconscience

I have been trying to compile libwebsockets from source and facing many issues with its depandencies like OpenSSL, Zlib etc, Have you tried compiling for andorid?

sandeep-india avatar Aug 20 '14 12:08 sandeep-india

Hi While bulding libwebsockets.a I disabled Openssl support to build the static Lib, How can I disable the Openssl in OFXLibwebsockets wrapper? To Integrate this with my project.

sandeep-india avatar Aug 21 '14 13:08 sandeep-india

If you swap out the libwebsockets.h that's included it should work near out of the box. I believe their API is the same either way, and it should just ignore the other stuff passed to it.

Let me know how that goes!

On Aug 21, 2014, at 9:14 AM, sandeep [email protected] wrote:

Hi While libwebsockets.a I disabled Openssl support to build the static Lib, How can I disable the Openssl in OFXLibwebsockets wrapper? To Integrate this with my project.

— Reply to this email directly or view it on GitHub.

robotconscience avatar Aug 21 '14 14:08 robotconscience

I build a static library(libwebsockets.a) of libwebsockets using android NDK r9c and current master branch of libwebsockets , then linked the with ofxLibwebsockets. while keeping the libwebsockets.h from ofxLibwebsockets it-self. Everything compiled verywell and I am able to launch the app on an Android device.But when I run simple client connection script it fails with the message "[ofxLibwebsockets] client connection failed"

I am sure that this is not a problem with internet connection etc, Does anything cross your mind about possible reasons for this? I tried setting network permissions on AndroidManifest.xml as well which was not fruitful.

As I mentioned earlier I build libwebsockets after disabling openssl support, Is this creating any trouble? Or does it have to do with using libwebsockets.h from ofxLibwebsockets?

sandeep-india avatar Aug 23 '14 04:08 sandeep-india

Hm, minus SSL shouldn't be the problem. The permissions thing was my first guess; I know in processing we just enable the "internet" permissions.

Double check 1) the network on your android device and 2) where it's trying to connect to. echo.websocket.org is a great test, as is running a ofxLibwebsockets server on your machine.

On Aug 23, 2014, at 12:46 AM, sandeep [email protected] wrote:

I build a static library(libwebsockets.a) of libwebsockets using android NDK r9c and current master branch of libwebsockets , then linked the with ofxLibwebsockets. while keeping the libwebsockets.h from ofxLibwebsockets it-self. Everything compiled verywell and I am able to launch the app on an Android device.But when I run simple client connection script it fails with the message "[ofxLibwebsockets] client connection failed"

I am sure that this is not a problem with internet connection etc, Does anything cross your mind about possible reasons for this? I tried setting network permissions on AndroidManifest.xml as well which was not fruitful.

As I mentioned earlier I build libwebsockets after disabling openssl support, Is this creating any trouble?

— Reply to this email directly or view it on GitHub.

robotconscience avatar Aug 23 '14 14:08 robotconscience

Hi,

I figured that you are using version 2.3 release of libwebsockets, and felt that version variance is creating the problem. So I built it with 2.3 and repeated the steps and it worked :)

sandeep-india avatar Aug 25 '14 12:08 sandeep-india

Hello! Can you try using the 0.8.4 branch and see if it works with the latest version of libwebsockets for Android? If so, can you submit a PR with the android lib? Thanks!

robotconscience avatar Sep 30 '14 16:09 robotconscience

Any news on this? I know it's an old topic, but I wish to use Spacebrew on android with ofx and this is a dependency to it.

aristizabal95 avatar Aug 22 '19 19:08 aristizabal95

Hey @aristizabal95, I’m sorry to say I’ve had to put writing code on the back burner for a bit. Sounds like you might be able to check out that other branch? Happy to merge in a PR if you get anywhere with it.

robotconscience avatar Aug 22 '19 22:08 robotconscience