I implemented a fiber library that you can use: https://github.com/JarkkoPFC/fiber

There's an example what does pretty much what you ask for.