problems with Stream no events fired

Oct 20, 2014 at 9:38 AM
Hi I have problems with the events not getting fired. There is no error or similar triggered anywhere in the code and the "EventsRelatedWithTweetCreation(IUserStream userStream)" is fired upon the call
userStream.StartStream();

However, after that no more events are triggered
Oct 21, 2014 at 9:45 AM
This is working perfectly well on my machine. Would you please give more details concerning your problem.
I will need more code in order to assist you.

Regards,
Linvi
Oct 22, 2014 at 12:54 PM
Actually what happens is NOTHING.....

There are no errors or anything, it simply doesnt return any Events when people tweets are created. I have bumped into similar problems before and then it was simply to uptade the clock through windows internet time synch.
I have tried also that this time but it doesnt help.
Oct 22, 2014 at 1:04 PM
Please share more of your code and try the following:
var us = Stream.CreateUserStream();
us.TweetCreatedByAnyone += (sender, args) =>
{
    Console.WriteLine(args.Tweet);
};
us.StartStream();
Let me know if this work when you publish a tweet or a friend of you publishes a tweet.
Linvi
Oct 22, 2014 at 1:18 PM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
using System.IO;
using Tweetinvi;
using Tweetinvi.Core.Enum;
using Tweetinvi.Core.Extensions;
using Tweetinvi.Core.Interfaces;
using Tweetinvi.Core.Interfaces.Controllers;
using Tweetinvi.Core.Interfaces.DTO;
using Tweetinvi.Core.Interfaces.Models;
using Tweetinvi.Core.Interfaces.Models.Parameters;
using Tweetinvi.Core.Interfaces.oAuth;
using Tweetinvi.Core.Interfaces.Streaminvi;
using Tweetinvi.Json;
using Stream = Tweetinvi.Stream;
using ADODB;
using System.Data.SqlClient;
    public Form1()
    {
        InitializeComponent();
    }
private void button1_Click(object sender, EventArgs e)
    {
TwitterCredentials.SetCredentials(accesstoken, accesssecret, consumerkey, consumersecret);
  TESTER();
}
     private void TESTER()
     {
         var us = Stream.CreateUserStream();
         us.TweetCreatedByAnyone += (sender, args) =>
         {
             Console.WriteLine(args.Tweet);
         };
         us.StartStream();

    }

Oct 22, 2014 at 1:21 PM
There was a funny formatting there i see now, but basically its a simple "Form1" C# and the code you sent. All other functions than stream seems to work fine, i can request from the timeline, post Tweets etc without any problems. Stream has stopped working though... No errors or anything,. simply doesnt return any events when there are new posts.
Oct 22, 2014 at 2:23 PM
I am not sure what is wrong with your code. I have similar logic working perfectly well on my machine.
If you put a breakpoint on the Console.WriteLine it is never reached?

Linvi
Oct 22, 2014 at 2:37 PM
no, that is exactly what i did. I had a breakpoint but no event is ever fired.
Oct 22, 2014 at 5:03 PM
I have tried this one, same problem...
var credentials=TwitterCredentials.CreateCredentials(accesstoken, accesssecret, consumerkey, consumersecret);


       TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
{
var user = User.GetLoggedUser();
//      var friends = user.GetFriends();

var userStream = Stream.CreateUserStream();
EventsRelatedWithTweetCreation(userStream);
userStream.StartStream();
});

}
    private static void EventsRelatedWithTweetCreation(IUserStream userStream)
    {

        string s = "";
        string connetionString = null;
        return;
}
Oct 22, 2014 at 5:15 PM
Oct 23, 2014 at 9:15 AM
Hello there,

I think your code is not correct, I cannot see in EventsRelatedWithTweetCreation that you register to the event.

You need to do something like:
us.TweetCreatedByAnyone += (sender, args) =>
{
    Console.WriteLine(args.Tweet);
};
Linvi
Oct 26, 2014 at 9:21 AM
 Thanks for your help i have tried that also, but no events fired, it looks like this now and still doesnt work

        var credentials = TwitterCredentials.CreateCredentials(accesstoken, accesssecret, consumerkey, consumersecret);

                               TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
        {
       var us = Stream.CreateUserStream();
            us.StartStream();
            EventsRelatedWithTweetCreation(us);

        });



    private static void EventsRelatedWithTweetCreation(IUserStream us)
    {


        us.TweetCreatedByAnyone += (sender, args) =>
        {
            Console.WriteLine(args.Tweet);
        };


    }
Oct 26, 2014 at 9:26 AM
Did you perhaps have any suggestion on what might be the problem of the synch of servertime? That was the problem last time the stream didnt work. I have synched the clock now and still not working
Nov 2, 2014 at 10:27 AM
You can make sure that you're using the correct DST settings. I had this issue with stream because of the fact that daylight saving time had ended but my machine was still using it.

Hope this helps someone.
Nov 2, 2014 at 11:43 AM
Yep i have figured out there might be some problem like that, however i have synched several different machines with Windows timeserver and also the pool.ntp.org.
and the problem is still not solved. I have tried also the following:
  1. create new apps and try (doesnt solve the problem)
  2. Try on other computer ( no solution)
  3. Different IP address ( no solution )
  4. regenerate all consumer keys etx ( no solution)
  5. Creating a brand new twitterprofile and registering all the DEV things again including a new APP (no solution)
so i am kind of running out of ideas... The only thing i have clearly seen being wrong is that the server time at ONE occasion was 20 minutes off otherwise everything has been working prior to that. I am using the same code that has been working fine for almost a year.

It would be fantastic if Twittinvi could issue a COMPLETE .net solution to run so that i can eliminate that the error is actually in the code.

thanks
Nov 3, 2014 at 5:33 PM
Hi Soriega,

I am sorry to hear that you have not been able to fix the problem but I do not understand what is wrong with your code.
You can maybe send me your code with your credentials so that I have a look into it to help you. As always I will not use the credentials but for the sole purpose of helping you.

It would be fantastic if Twittinvi could issue a COMPLETE .net solution to run so that i can eliminate that the error is actually in the code.

I do not understand what you mean by a COMPLETE .NET solution. Tweetinvi is 100% in C# .NET 4.0. If you mean not using third party API, I am trying to use the less number of 3rd party API and only well known libraries.

Kind Regards,
Linvi
Nov 19, 2014 at 11:43 PM
I think I'm having the same problems as soriega. I'm using filtered stream, it was working last week then all of a sudden the app stopped receiving tweets. No changes to the code and no errors.
Nov 20, 2014 at 9:56 AM
Hi superhaze421,

I will have the same answer as the one I gave to soriega. I will need your complete code with your credentials (through the contact page) to debug this issue as I don't face it personally.
I will not use the credentials but for the sole purpose of helping you.

I will not be there this weekend so you might have to wait until Monday to give you some answer.

Linvi
Dec 2, 2014 at 2:36 AM
I thought that I would say I'm experiencing the same problem. I implemented the sample code from website and no events are fired when I run it. I am able to do other things like search for tweets. I have synced my system time.

Thanks in advance for your help,

Carmen
Dec 2, 2014 at 8:15 PM
This bug is very strange, lots of people are reporting it but I have not yet been able to reproduce it.
As I requested to superhaze, would you send me your code so that I have a look into it (I will need the credentials, I will not use the credentials but for the sole purpose of helping you).

Linvi
Dec 2, 2014 at 10:17 PM
I could send the code, but would you be interested in remoting into my desktop. It could have something to do with my environment rather than the code itself??

I'm available this evening.

Carmen
Dec 3, 2014 at 12:54 AM
 public Form1()
        {
            InitializeComponent();
            cred = TwitterCredentials.CreateCredentials(accessToken, accessTokenSecret, consumerKey, consumerKeySecret);
            TwitterCredentials.SetCredentials(cred);
         }
 private void startStream()
{
            var filteredStream = Stream.CreateFilteredStream();
            filteredStream.AddTrack("cats");
            filteredStream.MatchingTweetReceived += (sender, args) => { MessageBox.Show(args.Tweet.Text); };
            filteredStream.StartStreamMatchingAllConditions();
    }
        private void button3_Click(object sender, EventArgs e)
        {
            startStream();
          
        }
Dec 3, 2014 at 5:07 PM
Am I able to sent the credentials via private message to you?

Thanks again,
Carmen
Dec 10, 2014 at 1:22 AM
Any update to this issue?

One thing is there error message are popping up in the console during runtime

The thread 0x1668 has exited with code 259 (0x103).
The thread 0x1904 has exited with code 259 (0x103).
The thread 0x714 has exited with code 259 (0x103).
The thread 0x1248 has exited with code 259 (0x103).
Dec 10, 2014 at 9:36 AM
Please have a look here. There is a temporary fix.

Regards,
Linvi
Marked as answer by linvi on 12/10/2014 at 10:58 AM
Dec 10, 2014 at 4:19 PM
This fix basically worked for me.