Constantly Losing Stuff
Lessons learned developing and using continuation-local-storage in Node
Continuation-local storage is one answer. Using a simple module, maybe a few shims, and a powerful and experimental new feature of the Node runtime (or a powerful and experimental bit of monkeypatching), you can now create namespaces that allow you to pass data through asynchronous call chains in Node without modifying any intervening code or abusing the request or response objects! And it turns out that something similar will work in the browser across XHR calls!
This talk will explain why there is a problem to be solved here, and how CLS goes about solving it. It will also use CLS to illuminate the underlying asynchronous listener patterns that make it possible, both in Node and in the browser (using Angular's Zones.js). There are some tricky concepts at play, but the basic API is surprisingly simple and is in production use in thousands of apps (even if not all of their developers know it).
Forrest has been a web developer and web development nerd since 1994. While he developed continuation-local storage as an offshoot of his work for New Relic, these days he helps npm deal with being one of the most popular packaging systems on the planet by working for npm, Inc.