Detecting when a historic stream has finished and switching to realtime events
Just had this question, so I'll share the answer here because it isn't yet documented properly: If you want to stream historic results at an accelerated speed, and then when you get to the present time switch to the live stream, you have to do the following: 1. subscribe to the stream with startTime (and optionally stopTime) set, and speed set to something more than 1.0 2. wait for the replay to finish, and then re-subscribe to the live stream without time parameters e.g.: socket.on('atlas_replay_finished', function(params) { // params are what you used to subscribe console.log('Stream finished:', params); // Subscribe to the live stream socket.emit('atlas_subscribe', {stream_type: 'probestatus'}); }); // Subscribe to a stream for a historic interval at x12 speed socket.emit('atlas_subscribe', {stream_type: 'probestatus', startTime: 1427551200, stopTime: 1427551300, speed: 12});
participants (1)
-
Chris Amin