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

New Post: UserStream.StartStream (400) Bad Request

$
0
0
Hi,
Using version 0.9.
I am having problems starting the UserStream, when I call UserStream.StartStream ( even calling UserStream.StartStreamAsynch is the same) I always receive a StreamStopped event. The credentials should be right since the "rateLimits" info is shown properly.
The exception is:
USERSTREAM ERROR: System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
Any ideas?
Here it is the code:
   var credentials = TwitterCredentials.CreateCredentials(token, secretToken,  ConsumerKey,  ConsumerSecret);
                TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
                {
                    this.UserStream = Stream.CreateUserStream();

                    var rateLimits = RateLimit.GetCurrentCredentialsRateLimits();
                    Console.WriteLine("You can access your timeline {0} times.", rateLimits.StatusesHomeTimelineLimit.Remaining);

                    UserStream.TweetCreatedByMe += (s, a) => { NotifyMyTweet(a); };
                    UserStream.TweetCreatedByFriend += (s, a) => { NotifyFriendTweet(a); };
                    UserStream.MessageReceived += (s, a) => { NotifyMessageTweet(a); };
                    UserStream.StreamStopped += (s, a) =>
                    {
                        Console.WriteLine("USERSTREAM ERROR: " + a.Exception.ToString());
                    };
                    UserStream.StreamRunning += (s, a) => { Console.WriteLine("USERSTREAM RUNNING"); };
                    UserStream.StreamResumed += (s, a) => { Console.WriteLine("USERSTREAM RESUMED"); };

                    UserStream.StartStream(); 
                });
Thanks,
Andrea

Viewing all articles
Browse latest Browse all 4126

Trending Articles



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