Actually, personally, I'd be looking at splitting the json and the images / binary bits, and doing it all over HTTP(S). But if you have a constraint of a TCP service... then BSON or protobufs.
On Thu, Jan 26, 2012 at 09:07, Nic Wise <[email protected]> wrote: > I'd be looking at BSON and/or protobuf's. Base64 adds 30% just in the > encoding, so while it might be ok for really small stuff, it's not > otherwise a good option IMO. > > As you control both ends, have a look into protocol buffers (it's a > google thing), and possible servicestack, tho thats "just" json. > > Might be also worth investigating using JSON ('cos it's EASY!) then as > you stream out thru the TCP socket, run it thru a compressed (gzip?) > stream writer (and reader on the other end), so it's auto-compressed > as it goes thru. But using binary would still be better I think. > > > > > On Thu, Jan 26, 2012 at 01:47, Dermot O Sullivan <[email protected]> wrote: >> Over TCP sockets. It's the reason I am thinking there must be a more >> efficient way of designing my network layer. Otherwise the images will >> be byte arrays, base64 encoded, then back to bytes when sensing over >> the socket. >> >> Http links to the image would only work in some scenarios, but users >> could potentially take the image on their phone camera, so actual >> bytes will need to be sent. >> >> Was looking at BSON a while ago. Perhaps this would be a better >> option. Anyone any experience with this? >> >> Sent from mobile device. Please excuse brevity & errors. >> >> On 26/01/2012, at 12:22 AM, Nic Wise <[email protected]> wrote: >> >>> What are you doing this over? HTTP? CAn you just send down a reference >>> to the image, and have it download it seperatly? So not included in >>> your data packet? >>> >>> On Wed, Jan 25, 2012 at 01:30, Dermot O Sullivan <[email protected]> wrote: >>>> Thanks for the replies (and head's up about the bug!) >>>> >>>> My network layer is currently all binary (.net serialization), but im >>>> considering swapping out to JSON (still sent over TCP sockets), as I feel >>>> once my app is out, upgrading the network protocol will be a huge pain if >>>> its all binary, not to mention problems with future cross platform etc... >>>> >>>> >>>> Most of my network packets should be largely text content, so this should >>>> work fine with JSON. Only a couple of things Im a little worried about: >>>> >>>> I need to send a datatable (only once per session, its expected to take a >>>> few seconds). Anyone have any experience with JSON serialization/deser of >>>> datatables? I expect the DT to be around 1000 rows x about 8 cols, with >>>> approx 20 chars per cell on average. Currently a binary serialized version >>>> is about 500kb, but compresses down to a tidy 55kb. >>>> >>>> The other item is I sometimes have to send small images (byte[]). probably >>>> about 150px square pngs, so maybe.. 10 - 15kb each. I assume base64 >>>> encoding >>>> is the best option for these, any ideas on possible performance based on >>>> anyones prior experience? >>>> >>>> >>>> Im going to test all of the above anyway, but just thought id see if anyone >>>> has any experience with it. Cheers! >>>> >>>> On Tue, Jan 24, 2012 at 9:28 PM, Nic Wise <[email protected]> wrote: >>>>> >>>>> I use the NewtonSoft one (is that the same one?), tho I think mine is >>>>> an older version. >>>>> >>>>> Works great. >>>>> >>>>> https://github.com/nicwise/DropNet/tree/master/Lib >>>>> >>>>> Also, I see you forked my DropNet thing on GitHub. I had to fix a bug >>>>> in that yesterday (and I intend to try to port the latest sometime in >>>>> the next month or 2, so I can use oauth): >>>>> >>>>> you might be better of with Kevin's one: >>>>> >>>>> https://github.com/kevinmcmahon/DropNet >>>>> >>>>> or possibly just do this patch: >>>>> >>>>> >>>>> https://github.com/dkarzon/DropNet/commit/485afe7a235df1c6c638a888982fc94a1de92ebf >>>>> >>>>> >>>>> - _restClient.BaseUrl = _apiBaseUrl; >>>>> 51 >>>>> + _restClient.BaseUrl = _apiContentBaseUrl; >>>>> >>>>> HOWEVER: I've found if you make a new app on DropBox, you MUST use API >>>>> v1 - and this uses API v0, so I'm not sure it'll even let you log in >>>>> :( >>>>> >>>>> >>>>> >>>>> On Tue, Jan 24, 2012 at 00:02, dermotos <[email protected]> wrote: >>>>>> Im thinking of using it in an app and also on a server. Just wondering >>>>>> has >>>>>> anyone else used it? >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://monotouch.2284126.n4.nabble.com/Anyone-used-JSON-NET-in-Monotouch-Any-Problems-tp4322517p4322517.html >>>>>> Sent from the MonoTouch mailing list archive at Nabble.com. >>>>>> _______________________________________________ >>>>>> MonoTouch mailing list >>>>>> [email protected] >>>>>> http://lists.ximian.com/mailman/listinfo/monotouch >>>>> >>>>> >>>>> >>>>> -- >>>>> Nic Wise >>>>> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise >>>>> b. http://www.fastchicken.co.nz/ >>>>> >>>>> Nearest Bus: find when the next bus is coming to your stop. >>>>> http://goo.gl/Vcz1p >>>>> mobileAgent (for FreeAgent): get your accounts in your pocket. >>>>> http://goo.gl/IuBU >>>>> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa >>>>> London Bike App: Find the nearest Boris Bike, and get riding! >>>>> http://goo.gl/Icp2 >>>> >>>> >>> >>> >>> >>> -- >>> Nic Wise >>> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise >>> b. http://www.fastchicken.co.nz/ >>> >>> Nearest Bus: find when the next bus is coming to your stop. >>> http://goo.gl/Vcz1p >>> mobileAgent (for FreeAgent): get your accounts in your pocket. >>> http://goo.gl/IuBU >>> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa >>> London Bike App: Find the nearest Boris Bike, and get riding! >>> http://goo.gl/Icp2 > > > > -- > Nic Wise > t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise > b. http://www.fastchicken.co.nz/ > > Nearest Bus: find when the next bus is coming to your stop. > http://goo.gl/Vcz1p > mobileAgent (for FreeAgent): get your accounts in your pocket. > http://goo.gl/IuBU > Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa > London Bike App: Find the nearest Boris Bike, and get riding! > http://goo.gl/Icp2 -- Nic Wise t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise b. http://www.fastchicken.co.nz/ Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p mobileAgent (for FreeAgent): get your accounts in your pocket. http://goo.gl/IuBU Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2 _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
