I described an approach here – feel free to use this if it's fit for your use-case:
https://news.ycombinator.com/item?id=46341604