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

Commented Unassigned: FilteredStream.AddTrack "OR" operator issue [2616]

$
0
0
I realize that the docs say to add each keyword separately, like so:
```
stream.AddTrack("linvi");
stream.AddTrack("tweetinvi");
```
However, I'd like to add them in one call:
```
stream.AddTrack("linvi,tweetinvi");
```

They both seem to work, with matching tweets received on the stream, and they both produce the same HTTPS request to Twitter (as seen in Fiddler):
```
https://stream.twitter.com/1.1/statuses/filter.json?track=linvi%2Ctweetinvi&stall_warnings=true
```

However, the latter (single-call), comma separated keyword track does not behave as expected. As stated, matching tweets are received on the stream; however, the ```MatchedTweetReceivedEventArgs.MatchingTracks``` is empty.

Further, I found that an associated Action<string> is _not_ called for the latter (single-call), comma separated keyword track.
```
stream.AddTrack("linvi,tweetinvi", tweetMessage => Console.Writeline("This will never be written! :[ "));
```
Comments: ** Comment from web user: linvi **

Sorry I think I did not reply clearly to your question. At the current time it is not possible to invoke every 'OR' track in one call.

``` c#
// INVALID way to add 'linvi' OR 'tweetinvi'
stream.AddTrack("linvi,tweetinvi");
```

The only way to do it, is to call it twice as suggested in your first example.

``` c#
// VALID way to add 'linvi' OR 'tweetinvi'
stream.AddTrack("linvi");
stream.AddTrack("tweetinvi");
```

I could add this as an improvement feature if needed.
Why do you need to invoke this in a single request?

Please consider the following code
``` c#
var fs = Stream.CreateFilteredStream();
var filters = "linvi,tweetinvi";
var filtersArray = filters.Split(',');
filtersArray.ForEach(filter => fs.AddTrack(filter));
```

Cheers,
Linvi


Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>