

Faster mobile apps by bundling backend API calls - with Trestle / Trigger.io - amirnathoo
https://www.trestleapp.com/blog/creating-fast-mobile-clients-using-trigger-io-and-trestle-s-chain-server

======
felixchan
Seems like Trigger's definateyy on a roll lately with all of this
integration/ease of development and tutorials.

I haven't heard of Trestle Chain before. But I have experienced these problems
with slow network on my mobile website. It's a pain, sometimes it takes a
second or so to load a simple AJAX + render some HTML. Might dive deeper with
Trestle and Trigger .

Anyone have any experience with Trestle/the performance?

~~~
jamroom
I'm the co-founder of Trestle (Brian), and this is something that my partner
Sham and I struggled with as well as we both have created apps that relied
heavily on a server backend.

With the Chain Server you basically bundle your API calls into "chains" that
you then send over to the server in 1 shot - it's actually really slick. Of
course not all API calls can be bundled this way since they are more of a "one
shot" type call, but if you want to store images, audio, user info, objects,
etc. and those items have relationships, you can do it all in one round trip.
Our clients make it super easy to make a chain and execute it too.

We're looking for developer feedback, so please let me know if you have any
suggestions or questions - we're all ears. Thanks!

~~~
lsb
The chainable API calls looks pretty convenient for bulk uploads. Is there any
way of lifting the 5-second restriction? What sort of limits do you foresee in
how many key-value pairs can get stored?

~~~
jamroom
The 5 second restriction is only on our Custom NodeJS service - that doesn't
apply to the Chain Server. For the custom service that can be increased if
needed, we just want to try to limit any runaway processes.

The DB backend (Object Database) has a limit of ~240 key value pairs
(attributes) per item, but with the Chain Server you could effectively "link"
multiple objects together to go beyond that if you wanted.

Note that all our media services allow you to save arbitrary data with each
media item as well, so you can store your meta data with your media item and
not have to create a separate entry in the object database to store that.

Hope this helps!

------
newhouseb
FYI - You can emulate this on your own backend quite easily provided you can
write a route that can serve multiple API calls at once. From the client-side,
you treat ajax-calls like you would treat auto-completed search - every time
you want to do an ajax call you set a timer that says 'Run this AJAX request
in 10ms', if you do another ajax call within 10ms, you cancel all timers and
fold those API requests into the current request. This chain continues until
you go 10ms without any calls and you send off a bundled API call to the
server.

~~~
jamroom
Completely - the only part that's hard is conditionals - what if you want to
check the success/fail of a link in the chain? You'll have to bring the
results back to your client.

The Trestle Chain server let's you create if/else conditionals that can run
different chain segments based on any results/headers returned from previous
links, so it's "scriptable" in a sense, which is cool.

