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

New Post: Do We Need Site Streams ?

$
0
0
Hello there,

SiteStream are very good but even after requesting an access 3 times, I never got one, so I am not sure how good it it.
It is possible to have multiple UserStream running on the same IP but they are limited and the only alternative you have is to use multiple OAuth application credentials (which is sometime the only solution to multiple rate-limits).
// Create the credentials, this is where you might want to use multiple application tokens.var cred1 = TwitterCredentials.CreateCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
var cred2 = TwitterCredentials.CreateCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");

// Create the streamsvar us1 = Stream.CreateUserStream();
var us2 = Stream.CreateUserStream();

// Register the events you want
us1.JsonObjectReceived += (sender, args) =>
{
    Console.WriteLine("user1 received message");
};

us2.JsonObjectReceived += (sender, args) =>
{
    Console.WriteLine("user2 received message");
};

// Start the streams
TwitterCredentials.ExecuteOperationWithCredentials(cred1, () => us1.StartStreamAsync());
TwitterCredentials.ExecuteOperationWithCredentials(cred2, () => us2.StartStreamAsync());
Please have a careful read to this documentation page to understand the limitation Twitter API uses on UserStream per application.

Please let me know if I can help you more.
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>