As far as I can tell, Cubism wants to interrogate - and it seems that it is fully developed around the interrogation, not events. A custom metric is just designed to get the data that the context solves, so you really need to write a custom context designed with things like events sent by the server and long polls / _changes feed architectures.
Or
Why not write a custom metric that fakes it? Basically, provide a context.metric request function that closes around the buffer . When you receive events, put them in the buffer. Then, when the cubist context approaches the polling of your metric sampling function (you can set clientDelay below, since now it will not actually increase network traffic), you can directly shift the buffer right away.
natevw
source share