Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Pausing FilteredStream, adding tracks, then resuming stops stream

$
0
0
Hi there,

The problem that you have is that you are pausing the stream instead of stopping the stream.
When you add a track, you need to restart the stream because only when you call .StartStream Tweetinvi creates the WebRequest.

Pausing a stream means that you only put it on hold but you need to respect the fact that you are not authorized to change the tracks within it because Twitter will continue to send you the information from the tracks of the initial query.

So what you want to do is the following:
privatevoid queryNotificationReceived(object sender, EventArgs e)
    {
        var required = _Flow.GetRequiredData();

        lock (queryList)
        {
            queryList = required.queries.ToList();
            stream.StopStream();
            stream.ClearTracks();

            foreach (var q in queryList){
                stream.AddTrack(q.QueryValue);
            }

            stream.ResumeStream();
        }
    }
Linvi

Viewing all articles
Browse latest Browse all 4126

Trending Articles