New JSON Hot Function Format
Hot functions enable high performance functions by keeping the function’s container running and streaming in requests/events. Our original hot format was/is HTTP, which works fine, but it’s fairly difficult to parse in a lot of languages and let’s be real here, who wants to use a 25 year old protocol with new bleeding edge technology? So what format is easy to parse in nearly every language? JSON. What format maps directly to data formats in your code? JSON. What format is pretty much the standard for most things these days? JSON. What’s a 4 letter word that rhymes with mason (sort of)? JSON. We’ve always wanted to have a simpler and more modern format (we’ve had this as a todo forever), and now it’s available.
It’s fairly straight forward, here’s an example (there’s more data, this just has the basics):
This means you can just JSON parse object by object in the input stream.
Keep in mind, if you’re using one of our FDK’s, you don’t really need to think about this since the FDK will take care of parsing this for you. But if you’re writing an FDK or want to use the raw stream, this is what it will look like.
More details on the format: https://github.com/fnproject/fn/blob/master/docs/function-format.md