/// <summary>
/// Start UserStreaming
/// </summary>
public void StartUserStreaming()
{
UserStream = UserSession.UserStreamBuilder();
// Separate stream events start
ConnectStreamEvents();
ConnectUserStreams();
// MORE MAGIC HAPPENS HERE
// The Userstreams only get tweets/direct messages from the point the connection is opened.
// Historical tweets/direct messages have to be gathered using the traditional paging/cursoring APIs
// (Request/Response REST).
// but the higher level client doesnt want to worry about all that complexity.
// in the BackfillPump, we gather these tweets/direct messages and pump them into the correct Observable
Task.Factory.StartNew(ProcessBackfillPump);
// If the UserStream disconnects, the userStreamConnected will fire & we'll reconnect
// TODO if stream connection doesnt connect, fail over to UserStream.UserStreamActive.Where(status => status.IsFalse()).Subscribe(StartPollingUpdates);
// TODO if cancellation requested externally, dont reconnect
UserStream.StreamActive.Where(status => status == StreamSignal.Stopped).Subscribe(_ =>
{
UserStream.Start();
});
}