Jko/record events

Event recording. Uses a model that's very similar to the Java SDK.
Could we just flush the queue if it fills up early?