Fusillade: An opinionated HTTP library for Mobile Development

Published on April 25, 2014

Fusillade helps you to write more efficient code in mobile and desktop\ applications written in C#. Its design goals and feature set are inspired by\ Volley as well as Picasso.

What even does this do for me?

Fusillade is a set of HttpMessageHandlers (i.e. “drivers” for HttpClient) that make your mobile applications more efficient and responsive:

  • Auto-deduplication of requests - if every instance of your TweetView class requests the same avatar image, Fusillade will only do one request and give the result to every instance.
  • Request Limiting - Requests are always dispatched 4 at a time (the Volley default) - issue lots of requests without overwhelming the network connection.
  • Request Prioritization - background requests should run at a lower priority than requests initiated by the user, but actually implementing this is quite difficult. With a few changes to your app, you can hint to Fusillade which requests should skip to the front of the queue.
  • Speculative requests - On page load, many apps will try to speculatively cache data (i.e. try to pre-download data that the user might click on). Marking requests as speculative will allow requests until a certain data limit is reached, then cancel future requests (i.e. “Keep downloading data in the background until we’ve got 5MB of cached data”)

How do I use it?

public static class NetCache  
    // Use to fetch data into a cache when a page loads. Expect that 
    // these requests will only get so far then give up and start failing
    public static HttpMessageHandler Speculative { get; set; }

    // Use for network requests that are running in the background
    public static HttpMessageHandler Background { get; set; }

    // Use for network requests that are fetching data that the user is
    // waiting on *right now*
    public static HttpMessageHandler UserInitiated { get; set; }

Then, create an HttpClient with the given handler:

var client = new HttpClient(NetCache.UserInitiated);  
var response = await client.GetAsync("http://httpbin.org/get");  
var str = await client.Content.ReadAsStringAsync();


Where does it work?

Everywhere! Fusillade is a Portable Library, it works on:

  • Xamarin.Android
  • Xamarin.iOS
  • Xamarin.Mac
  • Windows Desktop apps
  • WinRT / Windows Phone 8.1 apps
  • Windows Phone 8

Check it out on NuGet and on GitHub!

Anaïs Betts

Written by Anaïs [a.na'is] Betts, who lives in Berlin.

Twitter LogoCopyright 2018 Anaïs BettsGitHub Logo