This deduplicates the code for parsing historical vs. live messages. It introduces a MessageSink which hold some traits (some behavior as to how messages should be added). It is modelled after the Channel, which is why it has the addMessage signature. Ideally, I'd want to make a new function that just takes a message, but I couldn't come up with a good name (because ultimately, it will add a message to the sink). An alternative could be to make MessageSink a wrapper around Channel.
This should make it easier to parse specific messages (e.g. subs) without introducing differences between recent and live messages.
This deduplicates the code for parsing historical vs. live messages. It introduces a
MessageSink
which hold some traits (some behavior as to how messages should be added). It is modelled after theChannel
, which is why it has theaddMessage
signature. Ideally, I'd want to make a new function that just takes a message, but I couldn't come up with a good name (because ultimately, it will add a message to the sink). An alternative could be to makeMessageSink
a wrapper aroundChannel
.This should make it easier to parse specific messages (e.g. subs) without introducing differences between recent and live messages.