Networking / Httprequest / other native stuff (facebook etc)

Hi!,

I know it’s been asked a couple of times, but it’s still quite unclear to be honest.
I’m currently evaluating both moai and cocos2d+js after filtering out a big list of engines.

I’ve worked with cocos2d, and I like the architecture / api, the fact that it’s cross platform, the community and the tools.

Now, on to my questions:

There is currently no unified networking/httprequest implementation. How much work would it be to implement this? I can see problems with threading, but that could be solved by buffering responses, and then at a certain point calling callbacks.

Is there a sample of using the facebook sdk in cocos2d/js ?

I’d like to get started with a simple example on how to create bindings.
I’ve seen the generate scripts, but it’s unclear how I should use this to create Facebook bindings and normal glue-code.
It’s also unclear how to create bindings for certain libraries on android, because everything is very iPhone oriented.

How would one manage a-sync callbacks?
Is there a working example of obfuscating or compiling to byte code?

Will there be a common repository of binding-mappings?

What is the recommended way of doing binding? A generated binding with some common glue code, or try and create a common C++ library, and export that to lua (This is kind of like moai does things)

I need a small jumpstart… After that, I’ll be ready to contribute if things look promising.

There is the HttpClient that you will have to manually bind. It uses cURL under the hood and is very primitive. We went down this route, but it turned out to be a pain since you have to manually set all of the cURL options for each request. If you want SSL support, you have to recompile cURL to support it. The whole piece is a mess, to be honest. What we did instead was to just create our own binding and implemented a more proper networking library in both iOS and Android. We used AFNetworking in iOS and loopj’s Android Async Http Client in Android. The end result is far cleaner and uses way less code to get working. SSL requests worked perfectly too.

We take the same approach to Facebook and use the native Facebook SDKs for each platform as well.

If you’re new to creating your own custom bindings, I’d search through the forums and look at the examples in the cocos2dx repo for how to create them yourself.

@Joel can you share facebook and http bindings on github or something else? It will help us a lot and gave us more time for other tasks.

Thanks

We didn’t bind everything, just the few that we needed/used. Most of what we’ve done is highly customized to what we need it for, so posting on github would take a bunch of cleanup and time that I just don’t have at the moment. I’d familiarize yourself with how the bindings work in both iOS and Android and you can implement them yourself in an hour or two. It honestly doesn’t take that long.

ok Joel. I know that I will need to makek some bindings by my own, just asking for some real examples before trying by myself.