22 May 2013
The one about how networking 2.0 happened
A few months ago, I talked about networking 2.0, but what I didn’t mention was that the driving force behind these improvements was the Corona community’s own Bob Dickinson.
For awhile, Bob was pretty vocal about some of the shortcomings of the old network 1.0 stack, and made that clear in his bug reports where he expressed his frustration. He’d say things that were brutal like “Network request/download support is only suitable for toy apps,” but balance those comments with constructive thoughts about improvements he’d like to see.
Over an e-mail exchange, it turns out that Bob really wanted to make something happen:
What I would like to do is volunteer to rework the Corona networking APIs (specifically network.request and network.download) in order to both address the specific open bugs, and also to extend the APIs and make them more robust, as outlined in 14023. I think that this can be done without changing the API definitions (so the new implementations would be fully backward compatible and pass any current unit tests).
So after several conversations, we agreed to give it a go! One of my primary concerns was the API, and Bob was (thankfully) patient as I poured over every detail of the API changes. We’ve had several dozens of exchanges just on the API. We covered a bunch of things including error handling, distinguishing between text/binary in responses, and minutiae like how download file paths should be specified.
Here’s a typical example of the kind of exchange we had. In this one, we decided on the name for a new API to cancel http requests:
I went back and forth. I picked cancelRequest( ) because, unlike the
timer module, the network module has a couple of methods that deal
with things that you might think are cancelable and that are not
requests (the network status functions). But I’m fine either way.I have slight preference for the more succinct “network.cancel()”, so let’s go with that.
Then came development. Bob rewrote the Android implementation because a newer HttpURLConnection had become available since the time at which we wrote the original. He then ported over our existing iOS, Mac, and Windows implementations.
Given the number of platforms involved, it was definitely a significant undertaking and a Herculean effort by Bob. I could go on about all the technical details but long story short, we all have a richer set of http APIs.
Thanks Bob for all your hard work, generosity, and dedication. Corona is that much better for it!
Bob Dickinson
Posted at 00:32h, 23 MayThanks for the kudos Walter. It was a fun and challenging project – the hardest part being switching between C++ and Objective C (Mac/iOS), Java (Android), C (Windows), lua (test suite) and Python (test server), often writing in all languages and platforms in a single day. It gave me a lot of respect for the kind of challenges that your team faces on an ongoing basis and the skill and focus required to do this kind of development as well as your team does it. I hope everyone enjoys Networking 2.0!
IcySpark
Posted at 01:31h, 23 MayThank you Bob for putting your time and effort into this. A very selfless thing to do that benefits the whole Corona community.
Raymond Cheng
Posted at 05:50h, 23 MayThank you Bob
Matthew Webster
Posted at 06:57h, 23 MayWow, Bob, you are a hero, true and proper. Well done, congratulations and a massive thank you.
I have so much respect and admiration for anyone who can master those languages – and you’ve done it all and put network guru in there as well!
Stephen Lewis
Posted at 09:19h, 23 MayInteresting story. Way to turn frustration (and expertise) into something productive. Thank you for sharing your hard work Bob!
Chevol
Posted at 09:40h, 23 MayThank you so much Bob! Your work is very much appreciated.
Kerem
Posted at 11:11h, 23 MayBob, you are a hero indeed. Thank you very much for all you have done for the community. We are much indebted to you.
WideAwakeGames
Posted at 15:18h, 23 MayI assume Bob wasn’t interested in working for CL? If I found someone with the talent AND dedication shown here, there’d be a solid offer on the table.
Owen Yang
Posted at 19:13h, 23 Maygreat!!!
i think cancelRequest( ) is very good for many developers!
thanks bob
Raffaele
Posted at 23:49h, 23 MayGreat work Bob and thanks.
But I’m the only one who thinks is at least strage that an SDK for which I payed licenses relay on volunteers work to get such a core API as network bugfixed and up-to-date? How could we releay on corona for mission critical apps?
Don’t get me wrong, maybe if Bob could choose at the beginning the native way he saved a lot of mails, frustration and time.
JCH_APPLE
Posted at 05:46h, 24 MayRaffaele has a very pertinent point of view, it seems like important improvements were made by people not working for Coronalabs (my personal hero is Matt/Horacebury, every time I have a problem or a question he has found the solution before).
I hope these people at least don’t have to pay their subscription :o)
Congrats to everybody, Corona people’s efforts are great nut please encourage top level contributors, without them Coronalabs wouldn’t be what it is now.
Bob Dickinson
Posted at 20:51h, 25 MayI did struggle with the idea of contributing free code/work to a for-profit company. But the rationale for my volunteering to do this work was basically that if this was an open source effort, I would just go fix the code (and clearly, I wouldn’t be paid for that). I would do it mostly because I wanted it done for my own reasons, and secondarily for learning experience and a little ego boost from the community. So I thought, if I would be willing to do this for an open source effort, why wouldn’t I do this for a closed source project (where I like the project, the company, the people, etc). Sure, they’re doing this for profit, but what difference does that really make in the end? Should they be paying for this work because they’re for-profit? Maybe. But they weren’t going to, and I wanted it done, so I just stepped up and did it just like I would have done it on an open source project. And I got what I wanted. The network APIs (that I use) are solid, the company and the community gave me their thanks, and I learned a lot in the process (and, FWIW, I don’t have to pay for my Corona License for a while). So I admit that it’s a little weird, but it worked for me.
Joe
Posted at 12:07h, 30 MayThanks Bob!
Opus
Posted at 13:07h, 30 MayMuchas Gracias!
Praveen
Posted at 15:01h, 24 NovemberThanks Bob! This makes life better for all of us in the community.